|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator
public class JGroupsCacheReplicator
Field Summary | |
---|---|
static long |
DEFAULT_ASYNC_INTERVAL
Teh default interval for async cache replication |
Constructor Summary | |
---|---|
JGroupsCacheReplicator(boolean replicatePuts,
boolean replicateUpdates,
boolean replicateUpdatesViaCopy,
boolean replicateRemovals,
boolean replicateAsync)
Constructor called by factory |
Method Summary | |
---|---|
boolean |
alive()
Checks that the replicator is is STATUS_ALIVE . |
java.lang.Object |
clone()
Creates a clone of this listener. |
void |
dispose()
Give the listener a chance to cleanup and free resources when no longer needed |
long |
getAsynchronousReplicationInterval()
Get the time interval is ms between asynchronous replication |
boolean |
isReplicateAsync()
Weather or not the cache is replicated asynchronously. |
boolean |
isReplicatePuts()
Wether or not puts are replicated |
boolean |
isReplicateRemovals()
wether or not removals are replicated |
boolean |
isReplicateUpdates()
Wether or not updates are replicated |
boolean |
isReplicateUpdatesViaCopy()
Returns whether update is through copy or invalidate |
(package private) static java.util.List |
listRemoteCachePeers(Ehcache cache)
Package protected List of cache peers |
boolean |
notAlive()
Returns whether the replicator is not active. |
void |
notifyElementEvicted(Ehcache cache,
Element element)
Called immediately after an element is evicted from the cache. |
void |
notifyElementExpired(Ehcache cache,
Element element)
Called immediately after an element is found to be expired. |
void |
notifyElementPut(Ehcache cache,
Element element)
Called immediately after an element has been put into the cache. |
void |
notifyElementRemoved(Ehcache cache,
Element element)
Called immediately after an attempt to remove an element. |
void |
notifyElementUpdated(Ehcache cache,
Element element)
Called immediately after an element has been put into the cache and the element already existed in the cache. |
void |
notifyRemoveAll(Ehcache cache)
Called during Ehcache.removeAll() to indicate that the all
elements have been removed from the cache in a bulk operation. |
protected void |
sendNotification(Ehcache cache,
JGroupEventMessage e)
Used to send notification to the peer. |
void |
setAsynchronousReplicationInterval(long asynchronousReplicationInterval)
Set the time inteval for asynchronous replication |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_ASYNC_INTERVAL
Constructor Detail |
---|
public JGroupsCacheReplicator(boolean replicatePuts, boolean replicateUpdates, boolean replicateUpdatesViaCopy, boolean replicateRemovals, boolean replicateAsync)
replicatePuts
- replicateUpdates
- replicateUpdatesViaCopy
- replicateRemovals
- replicateAsync
- Method Detail |
---|
public boolean isReplicateAsync()
public boolean isReplicatePuts()
public boolean isReplicateRemovals()
public boolean isReplicateUpdates()
public boolean alive()
STATUS_ALIVE
.
alive
in interface CacheReplicator
STATUS_ALIVE
, else false.public boolean isReplicateUpdatesViaCopy()
isReplicateUpdatesViaCopy
in interface CacheReplicator
public boolean notAlive()
notAlive
in interface CacheReplicator
public void dispose()
dispose
in interface CacheEventListener
public void notifyElementExpired(Ehcache cache, Element element)
Cache.remove(Object)
method will block until this method returns.
As the Element
has been expired, only what was the key of the element is known.
Elements are checked for expiry in ehcache at the following times:
Cache.DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS
notifyElementExpired
in interface CacheEventListener
cache
- the cache emitting the notificationelement
- the element that has just expired
Deadlock Warning: expiry will often come from the DiskStore
expiry thread. It holds a lock to the DiskStorea the time the
notification is sent. If the implementation of this method calls into a
synchronized Cache
method and that subsequently calls into
DiskStore a deadlock will result. Accordingly implementers of this method
should not call back into Cache.protected void sendNotification(Ehcache cache, JGroupEventMessage e)
cache
- e
- public void notifyElementPut(Ehcache cache, Element element) throws CacheException
Cache.put(net.sf.ehcache.Element)
method
will block until this method returns.
Implementers may wish to have access to the Element's fields, including value, so the
element is provided. Implementers should be careful not to modify the element. The
effect of any modifications is undefined.
notifyElementPut
in interface CacheEventListener
cache
- the cache emitting the notificationelement
- the element which was just put into the cache.
CacheException
public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException
CacheEventListener.notifyRemoveAll(net.sf.ehcache.Ehcache)
CacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
notifyElementRemoved
in interface CacheEventListener
cache
- the cache emitting the notificationelement
- the element just deleted, or a synthetic element with just the key set if
no element was removed.
CacheException
public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException
Cache.put(net.sf.ehcache.Element)
method
will block until this method returns.
Implementers may wish to have access to the Element's fields, including value, so the
element is provided. Implementers should be careful not to modify the element. The
effect of any modifications is undefined.
notifyElementUpdated
in interface CacheEventListener
cache
- the cache emitting the notificationelement
- the element which was just put into the cache.
CacheException
public void notifyElementEvicted(Ehcache cache, Element element)
notifyElementEvicted
in interface CacheEventListener
cache
- the cache emitting the notificationelement
- the element that has just been evictedpublic void notifyRemoveAll(Ehcache cache)
Ehcache.removeAll()
to indicate that the all
elements have been removed from the cache in a bulk operation. The usual
CacheEventListener.notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
is not called.
This notification exists because clearing a cache is a special case. It is often
not practical to serially process notifications where potentially millions of elements
have been bulk deleted.
notifyRemoveAll
in interface CacheEventListener
cache
- the cache emitting the notificationstatic java.util.List listRemoteCachePeers(Ehcache cache)
cache
-
CachePeer
peers for the given cache, excluding
the local peer.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface CacheEventListener
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if the listener could not be cloned.public long getAsynchronousReplicationInterval()
public void setAsynchronousReplicationInterval(long asynchronousReplicationInterval)
asynchronousReplicationInterval
- the interval between replication
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |