|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.jcs.auxiliary.javagroups.JavaGroupsCache
Auxiliary cache using javagroups. Expects to be created with a Channel, the
JavaGroupsCacheFactoryis responsible for creating that channel. To
do so it uses configuration properties specified by an instance of
JavaGroupsCacheAttributes.
At creation time the provided channel is connected to a group having the same name as the cache / region name this auxiliary is associated with. update / remove / removeAll operations are broadcast to all members of the group. A listener thread processes requests from other members of the group, and dispatches to appropriate methods on the associated CompositeCache.
Calls to get are currently ignored.
Messages are sent to peers asynchronously. Synchronous messaging could be added using MessageDispatcher or RpcDispatcher. Combined with a get implementation this could provide much higher cache consistency (but with a substantial speed penalty).
| Field Summary |
| Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType |
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE |
| Constructor Summary | |
JavaGroupsCache(CompositeCache cache,
org.jgroups.Channel channel,
boolean getFromPeers)
|
|
| Method Summary | |
void |
block()
|
void |
dispose()
Dispose this cache, terminates the listener thread and disconnects the channel from the group. |
ICacheElement |
get(java.io.Serializable key)
If 'getFromPeers' is true, this will attempt to get the requested element from ant other members of the group. |
java.lang.String |
getCacheName()
Accessor for cacheName property |
int |
getCacheType()
Get the cache type (always Lateral). |
java.util.Set |
getGroupKeys(java.lang.String group)
Not implemented (I believe since get is not supported, this should also not be). |
int |
getSize()
Since this is a lateral, size is not defined. |
IStats |
getStatistics()
Returns the historical and statistical data for a region's auxiliary cache. |
java.lang.String |
getStats()
getStats |
int |
getStatus()
Returns the status of this auxiliary. |
java.lang.Object |
handle(org.jgroups.Message msg)
Handles a message from a peer. |
boolean |
remove(java.io.Serializable key)
Sends a request to all peers to remove the element having the provided key. |
void |
removeAll()
Sends a request to remove ALL elements from the peers |
void |
send(ICacheElement element,
int command)
|
void |
suspect(org.jgroups.Address suspectedAddress)
|
void |
update(ICacheElement ce)
Sends the provided element to all peers (connected to the same channel and region name). |
void |
viewAccepted(org.jgroups.View view)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JavaGroupsCache(CompositeCache cache,
org.jgroups.Channel channel,
boolean getFromPeers)
throws java.lang.Exception
| Method Detail |
public void send(ICacheElement element,
int command)
public void update(ICacheElement ce)
throws java.io.IOException
update in interface AuxiliaryCachece - CacheElement to replicate
java.io.IOException - Never thrown by this implementation
public ICacheElement get(java.io.Serializable key)
throws java.io.IOException
get in interface AuxiliaryCachekey -
java.io.IOException - Never thrown by this implementation
public boolean remove(java.io.Serializable key)
throws java.io.IOException
remove in interface AuxiliaryCachekey - Key of element to be removed
java.io.IOException - Never thrown by this implementation
public void removeAll()
throws java.io.IOException
removeAll in interface AuxiliaryCachejava.io.IOException - Never thrown by this implementation
public void dispose()
throws java.io.IOException
dispose in interface AuxiliaryCachejava.io.IOExceptionpublic int getSize()
getSize in interface AuxiliaryCachepublic int getStatus()
getStatus in interface AuxiliaryCacheCacheConstantspublic java.lang.String getCacheName()
getCacheName in interface AuxiliaryCachepublic java.util.Set getGroupKeys(java.lang.String group)
getGroupKeys in interface AuxiliaryCachegroup - Ignored
public int getCacheType()
getCacheType in interface ICacheTypepublic java.lang.Object handle(org.jgroups.Message msg)
handle in interface org.jgroups.blocks.RequestHandlermsg - The JavaGroups Message
public void viewAccepted(org.jgroups.View view)
viewAccepted in interface org.jgroups.MembershipListenerpublic void suspect(org.jgroups.Address suspectedAddress)
suspect in interface org.jgroups.MembershipListenerpublic void block()
block in interface org.jgroups.MembershipListenerpublic java.lang.String getStats()
getStats in interface ICachepublic IStats getStatistics()
AuxiliaryCache
getStatistics in interface AuxiliaryCache
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||