|
|||||||||||
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
JavaGroupsCacheFactory
is 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 AuxiliaryCache
ce
- CacheElement to replicate
java.io.IOException
- Never thrown by this implementationpublic ICacheElement get(java.io.Serializable key) throws java.io.IOException
get
in interface AuxiliaryCache
key
-
java.io.IOException
- Never thrown by this implementationpublic boolean remove(java.io.Serializable key) throws java.io.IOException
remove
in interface AuxiliaryCache
key
- Key of element to be removed
java.io.IOException
- Never thrown by this implementationpublic void removeAll() throws java.io.IOException
removeAll
in interface AuxiliaryCache
java.io.IOException
- Never thrown by this implementationpublic void dispose() throws java.io.IOException
dispose
in interface AuxiliaryCache
java.io.IOException
public int getSize()
getSize
in interface AuxiliaryCache
public int getStatus()
getStatus
in interface AuxiliaryCache
CacheConstants
public java.lang.String getCacheName()
getCacheName
in interface AuxiliaryCache
public java.util.Set getGroupKeys(java.lang.String group)
getGroupKeys
in interface AuxiliaryCache
group
- Ignored
public int getCacheType()
getCacheType
in interface ICacheType
public java.lang.Object handle(org.jgroups.Message msg)
handle
in interface org.jgroups.blocks.RequestHandler
msg
- The JavaGroups Message
public void viewAccepted(org.jgroups.View view)
viewAccepted
in interface org.jgroups.MembershipListener
public void suspect(org.jgroups.Address suspectedAddress)
suspect
in interface org.jgroups.MembershipListener
public void block()
block
in interface org.jgroups.MembershipListener
public java.lang.String getStats()
getStats
in interface ICache
public IStats getStatistics()
AuxiliaryCache
getStatistics
in interface AuxiliaryCache
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |