net.sf.ehcache.CacheManager and net.sf.ehcache.Cache events and propagates those to
CachePeer peers of the Cache.
| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| protected final boolean | replicatePuts
Whether to replicate puts. |
| protected boolean | replicatePutsViaCopy
Whether a put should replicated by copy or by invalidation, (a remove). |
| protected final boolean | replicateRemovals
Whether to replicate removes |
| protected final boolean | replicateUpdates
Whether to replicate updates. |
| protected final boolean | replicateUpdatesViaCopy
Whether an update (a put) should be by copy or by invalidation, (a remove). |
| protected Status | status
The status of the replicator. |
| Access | Constructor and Description |
|---|---|
| public | RMISynchronousCacheReplicator(boolean replicatePuts, boolean replicatePutsViaCopy, boolean replicateUpdates, boolean replicateUpdatesViaCopy, boolean replicateRemovals)
Constructor for internal and subclass use |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | alive()
Implements net. STATUS_ALIVE.
|
| public Object | Returns: a cloneOverrides java. Implements net. |
| public void | dispose()
Implements net. |
| public final boolean | Returns: whether update is through copy or invalidateImplements net. |
| pack-priv static List | Returns: a list ofCachePeer peers for the given cache, excluding the local peer.Package protected List of cache peers |
| public final boolean | Returns: true if the status is not STATUS_ALIVEImplements net. |
| public void | notifyElementEvicted(final Ehcache
the cache emitting the notification cache, final Element the element that has just been evicted element)Implements net. |
| public final void | notifyElementExpired(final Ehcache
the cache emitting the notification cache, final Element the element that has just expired
element)
Deadlock Warning: expiry will often come from the Implements net. |
| public void | notifyElementPut(final Ehcache
the cache emitting the notification cache, final Element the element which was just put into the cache. element)Implements net. |
| public void | notifyElementRemoved(final Ehcache
the cache emitting the notification cache, final Element the element just deleted, or a synthetic element with just the key set if
no element was removed.param element just deleted element)Implements net. |
| public void | notifyElementUpdated(final Ehcache
the cache emitting the notification cache, final Element the element which was just put into the cache. element)Implements net. |
| public void | notifyRemoveAll(final Ehcache
the cache emitting the notification cache)Implements net. net. to indicate that the all
elements have been removed from the cache in a bulk operation.
|
| protected static void | |
| protected static void | |
| protected void |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| replicatePuts | back to summary |
|---|---|
| protected final boolean replicatePuts Whether to replicate puts. | |
| replicatePutsViaCopy | back to summary |
|---|---|
| protected boolean replicatePutsViaCopy Whether a put should replicated by copy or by invalidation, (a remove). By copy is best when the entry is expensive to produce. By invalidation is best when we are really trying to force other caches to sync back to a canonical source like a database. An example of a latter usage would be a read/write cache being used in Hibernate.
This setting only has effect if | |
| replicateRemovals | back to summary |
|---|---|
| protected final boolean replicateRemovals Whether to replicate removes | |
| replicateUpdates | back to summary |
|---|---|
| protected final boolean replicateUpdates Whether to replicate updates. | |
| replicateUpdatesViaCopy | back to summary |
|---|---|
| protected final boolean replicateUpdatesViaCopy Whether an update (a put) should be by copy or by invalidation, (a remove). By copy is best when the entry is expensive to produce. By invalidation is best when we are really trying to force other caches to sync back to a canonical source like a database. An example of a latter usage would be a read/write cache being used in Hibernate.
This setting only has effect if | |
| status | back to summary |
|---|---|
| protected Status status The status of the replicator. Only replicates when | |
| RMISynchronousCacheReplicator | back to summary |
|---|---|
| public RMISynchronousCacheReplicator(boolean replicatePuts, boolean replicatePutsViaCopy, boolean replicateUpdates, boolean replicateUpdatesViaCopy, boolean replicateRemovals) Constructor for internal and subclass use | |
| alive | back to summary |
|---|---|
| public final boolean alive() Implements net. Checks that the replicator is is
| |
| clone | back to summary |
|---|---|
| public Object clone() throws CloneNotSupportedException Overrides java. Implements net. Creates a clone of this listener. This method will only be called by ehcache before a cache is initialized. This may not be possible for listeners after they have been initialized. Implementations should throw CloneNotSupportedException if they do not support clone.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements net. Give the replicator a chance to cleanup and free resources when no longer needed | |
| isReplicateUpdatesViaCopy | back to summary |
|---|---|
| public final boolean isReplicateUpdatesViaCopy() Implements net. Doc from net. Returns whether update is through copy or invalidate
| |
| listRemoteCachePeers | back to summary |
|---|---|
| pack-priv static List Package protected List of cache peers | |
| notAlive | back to summary |
|---|---|
| public final boolean notAlive() Implements net. Asserts that the replicator is active.
| |
| notifyElementEvicted | back to summary |
|---|---|
| public void notifyElementEvicted(final Ehcache cache, final Element element) Implements net. Called immediately after an element is evicted from the cache. Evicted in this sense means evicted from one store and not moved to another, so that it exists nowhere in the local cache. In a sense the Element has been removed from the cache, but it is different, thus the separate notification. This replicator does not propagate these events | |
| notifyElementExpired | back to summary |
|---|---|
| public final void notifyElementExpired(final Ehcache cache, final Element element) Implements net. Doc from net. Called immediately after an element is found to be expired. The
Elements are checked for expiry in ehcache at the following times:
This implementation does not propagate expiries. It does not need to do anything because the element will expire in the remote cache at the same time. If the remote peer is not configured the same way they should not be in an cache cluster.
| |
| notifyElementPut | back to summary |
|---|---|
| public void notifyElementPut(final Ehcache cache, final Element element) throws CacheException Implements net. Called immediately after an element has been put into the cache. The 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. | |
| notifyElementRemoved | back to summary |
|---|---|
| public void notifyElementRemoved(final Ehcache cache, final Element element) throws CacheException Implements net. Called immediately after an attempt to remove an element. The remove method will block until this method returns. This notification is received regardless of whether the cache had an element matching the removal key or not. If an element was removed, the element is passed to this method, otherwise a synthetic element, with only the key set is passed in.
| |
| notifyElementUpdated | back to summary |
|---|---|
| public void notifyElementUpdated(final Ehcache cache, final Element element) throws CacheException Implements net. Called immediately after an element has been put into the cache and the element already existed in the cache. This is thus an update.
The 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. | |
| notifyRemoveAll | back to summary |
|---|---|
| public void notifyRemoveAll(final Ehcache cache) Implements net. Called during 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.
| |
| replicatePutNotification | back to summary |
|---|---|
| protected static void replicatePutNotification(Ehcache cache, Element element) throws RemoteCacheException Does the actual RMI remote call. If a Throwable occurs a SEVERE log message will be logged, but attempts to replicate to the other peers will continue. | |
| replicateRemovalNotification | back to summary |
|---|---|
| protected static void replicateRemovalNotification(Ehcache cache, Serializable key) throws RemoteCacheException Does the actual RMI remote call. If a Throwable occurs a SEVERE log message will be logged, but attempts to replicate to the other peers will continue. | |
| replicateRemoveAllNotification | back to summary |
|---|---|
| protected void replicateRemoveAllNotification(Ehcache cache) Does the actual RMI remote call. If a Throwable occurs a SEVERE log message will be logged, but attempts to replicate to the other peers will continue. | |