Class AbstractRemoteCacheListener<K,V> 
java.lang.Object
org.apache.commons.jcs3.auxiliary.remote.AbstractRemoteCacheListener<K,V> 
- All Implemented Interfaces:
- Remote,- IRemoteCacheListener<K,,- V> - ICacheListener<K,- V> 
- Direct Known Subclasses:
- RemoteCacheListener,- RemoteHttpClientListener
public abstract class AbstractRemoteCacheListener<K,V> 
extends Object
implements IRemoteCacheListener<K,V> 
Shared listener base.
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractRemoteCacheListener(IRemoteCacheAttributes irca, ICompositeCacheManager cacheMgr, IElementSerializer elementSerializer) Only need one since it does work for all regions, just reference by multiple region names.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ICompositeCacheManagerGets the cacheManager attribute of the RemoteCacheListener object.longGets the listenerId attribute of the RemoteCacheListener object.This is for debugging.Gets the remoteType attribute of the RemoteCacheListener objectvoidhandleDispose(String cacheName) Notifies the subscribers for freeing up the named cache.voidhandlePut(ICacheElement<K, V> cb) If this is configured to remove on put, then remove the element since it has been updated elsewhere. cd should be incomplete for faster transmission.voidhandleRemove(String cacheName, K key) Calls localRemove on the CompositeCache.voidhandleRemoveAll(String cacheName) Calls localRemoveAll on the CompositeCache.voidsetListenerId(long id) Let the remote cache set a listener_id.toString()For easier debugging.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.jcs3.auxiliary.remote.behavior.IRemoteCacheListenerdispose
- 
Constructor Details- 
AbstractRemoteCacheListenerpublic AbstractRemoteCacheListener(IRemoteCacheAttributes irca, ICompositeCacheManager cacheMgr, IElementSerializer elementSerializer) Only need one since it does work for all regions, just reference by multiple region names.The constructor exports this object, making it available to receive incoming calls. The callback port is anonymous unless a local port value was specified in the configuration. - Parameters:
- irca- cache configuration
- cacheMgr- the cache hub
- elementSerializer- a custom serializer
 
 
- 
- 
Method Details- 
setListenerIdLet the remote cache set a listener_id. Since there is only one listener for all the regions and every region gets registered? the id shouldn't be set if it isn't zero. If it is we assume that it is a reconnect.- Specified by:
- setListenerIdin interface- ICacheListener<K,- V> 
- Specified by:
- setListenerIdin interface- IRemoteCacheListener<K,- V> 
- Parameters:
- id- The new listenerId value
- Throws:
- IOException
 
- 
getListenerIdGets the listenerId attribute of the RemoteCacheListener object. This is stored in the object. The RemoteCache object contains a reference to the listener and get the id this way.- Specified by:
- getListenerIdin interface- ICacheListener<K,- V> 
- Specified by:
- getListenerIdin interface- IRemoteCacheListener<K,- V> 
- Returns:
- The listenerId value
- Throws:
- IOException
 
- 
getRemoteTypeGets the remoteType attribute of the RemoteCacheListener object- Specified by:
- getRemoteTypein interface- IRemoteCacheListener<K,- V> 
- Returns:
- The remoteType value
- Throws:
- IOException
 
- 
handlePutIf this is configured to remove on put, then remove the element since it has been updated elsewhere. cd should be incomplete for faster transmission. We don't want to pass data only invalidation. The next time it is used the local cache will get the new version from the remote store.If remove on put is not configured, then update the item. - Specified by:
- handlePutin interface- ICacheListener<K,- V> 
- Specified by:
- handlePutin interface- IRemoteCacheListener<K,- V> 
- Parameters:
- cb-
- Throws:
- IOException
 
- 
handleRemoveCalls localRemove on the CompositeCache.- Specified by:
- handleRemovein interface- ICacheListener<K,- V> 
- Specified by:
- handleRemovein interface- IRemoteCacheListener<K,- V> 
- Parameters:
- cacheName-
- key-
- Throws:
- IOException
 
- 
handleRemoveAllCalls localRemoveAll on the CompositeCache.- Specified by:
- handleRemoveAllin interface- ICacheListener<K,- V> 
- Specified by:
- handleRemoveAllin interface- IRemoteCacheListener<K,- V> 
- Parameters:
- cacheName-
- Throws:
- IOException
 
- 
handleDisposeDescription copied from interface:IRemoteCacheListenerNotifies the subscribers for freeing up the named cache.- Specified by:
- handleDisposein interface- ICacheListener<K,- V> 
- Specified by:
- handleDisposein interface- IRemoteCacheListener<K,- V> 
- Parameters:
- cacheName-
- Throws:
- IOException
 
- 
getCacheManagerGets the cacheManager attribute of the RemoteCacheListener object. This is one of the few places that force the cache to be a singleton.
- 
getLocalHostAddressThis is for debugging. It allows the remote server to log the address of clients.- Specified by:
- getLocalHostAddressin interface- IRemoteCacheListener<K,- V> 
- Returns:
- String
- Throws:
- IOException
 
- 
toStringFor easier debugging.
 
-