Class LateralTCPListener<K,V> 
java.lang.Object
org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.LateralTCPListener<K,V> 
- All Implemented Interfaces:
- ILateralCacheListener<K,,- V> - ICacheListener<K,,- V> - IShutdownObserver
public class LateralTCPListener<K,V> 
extends Object
implements ILateralCacheListener<K,V>, IShutdownObserver 
Listens for connections from other TCP lateral caches and handles them. The initialization method
 starts a listening thread, which creates a socket server. When messages are received they are
 passed to a pooled executor which then calls the appropriate handle method.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassDeprecated.No longer usedclassDeprecated.No longer used
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedDeprecated.Specify serializerprotectedLateralTCPListener(ITCPLateralCacheAttributes ilca, IElementSerializer serializer) Only need one since it does work for all regions, just reference by multiple region names.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispose()Dispose this listenerprotected CompositeCache<K,V> Gets the cacheManager attribute of the LateralCacheTCPListener object.intstatic <K,V> LateralTCPListener<K, V> getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr) Deprecated.Specify serializerstatic <K,V> LateralTCPListener<K, V> getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr, IElementSerializer serializer) Gets the instance attribute of the LateralCacheTCPListener class.longGets the listenerId attribute of the LateralCacheTCPListener objectintThis is roughly the number of updates the lateral has received.intvoidhandleDispose(String cacheName) This marks this instance as terminated.Gets the cache that was injected by the lateral factory.handleGetKeySet(String cacheName) Gets the cache that was injected by the lateral factory.Map<K,ICacheElement<K, V>> handleGetMatching(String cacheName, String pattern) Gets the cache that was injected by the lateral factory.voidhandlePut(ICacheElement<K, V> element) Increments the put count.voidhandleRemove(String cacheName, K key) Increments the remove count.voidhandleRemoveAll(String cacheName) Gets the cache that was injected by the lateral factory.voidinit()This starts the ListenerThread on the specified port.voidsetCacheManager(ICompositeCacheManager cacheMgr) voidsetListenerId(long id) Let the lateral cache set a listener_id.voidsetTcpLateralCacheAttributes(ITCPLateralCacheAttributes tcpLateralCacheAttributes) voidshutdown()Shuts down the receiver.
- 
Constructor Details- 
LateralTCPListenerDeprecated.Specify serializerOnly need one since it does work for all regions, just reference by multiple region names.- Parameters:
- ilca- ITCPLateralCacheAttributes
 
- 
LateralTCPListenerOnly need one since it does work for all regions, just reference by multiple region names.- Parameters:
- ilca- ITCPLateralCacheAttributes
- serializer- the serializer to use when receiving
 
 
- 
- 
Method Details- 
getInstance@Deprecated public static <K,V> LateralTCPListener<K,V> getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr) Deprecated.Specify serializerGets the instance attribute of the LateralCacheTCPListener class.- Parameters:
- ilca- ITCPLateralCacheAttributes
- cacheMgr-
- Returns:
- The instance value
 
- 
getInstancepublic static <K,V> LateralTCPListener<K,V> getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr, IElementSerializer serializer) Gets the instance attribute of the LateralCacheTCPListener class.- Parameters:
- ilca- ITCPLateralCacheAttributes
- cacheMgr-
- serializer- the serializer to use when receiving
- Returns:
- The instance value
 
- 
initThis starts the ListenerThread on the specified port.- Specified by:
- initin interface- ILateralCacheListener<K,- V> 
 
- 
setListenerIdLet the lateral 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.By default, the listener id is the vmid. The service should set this value. This value will never be changed by a server we connect to. It needs to be non static, for unit tests. The service will use the value it sets in all send requests to the sender. - Specified by:
- setListenerIdin interface- ICacheListener<K,- V> 
- Parameters:
- id- The new listenerId value
- Throws:
- IOException
 
- 
getListenerIdGets the listenerId attribute of the LateralCacheTCPListener object- Specified by:
- getListenerIdin interface- ICacheListener<K,- V> 
- Returns:
- The listenerId value
- Throws:
- IOException
 
- 
handlePutIncrements the put count. Gets the cache that was injected by the lateral factory. Calls put on the cache.- Specified by:
- handlePutin interface- ICacheListener<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
handleRemoveIncrements the remove count. Gets the cache that was injected by the lateral factory. Calls remove on the cache.- Specified by:
- handleRemovein interface- ICacheListener<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
handleRemoveAllGets the cache that was injected by the lateral factory. Calls removeAll on the cache.- Specified by:
- handleRemoveAllin interface- ICacheListener<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
handleGetGets the cache that was injected by the lateral factory. Calls get on the cache.- Parameters:
- cacheName-
- key-
- Returns:
- a ICacheElement
- Throws:
- IOException
 
- 
handleGetMatchingpublic Map<K,ICacheElement<K, handleGetMatchingV>> (String cacheName, String pattern) throws IOException Gets the cache that was injected by the lateral factory. Calls get on the cache.- Parameters:
- cacheName- the name of the cache
- pattern- the matching pattern
- Returns:
- Map
- Throws:
- IOException
 
- 
handleGetKeySetGets the cache that was injected by the lateral factory. Calls getKeySet on the cache.- Parameters:
- cacheName- the name of the cache
- Returns:
- a set of keys
- Throws:
- IOException
 
- 
handleDisposeThis marks this instance as terminated.- Specified by:
- handleDisposein interface- ICacheListener<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
disposeDescription copied from interface:ILateralCacheListenerDispose this listener- Specified by:
- disposein interface- ILateralCacheListener<K,- V> 
 
- 
getCacheGets the cacheManager attribute of the LateralCacheTCPListener object.Normally this is set by the factory. If it wasn't set the listener defaults to the expected singleton behavior of the cache manager. - Parameters:
- name-
- Returns:
- CompositeCache
 
- 
getPutCntThis is roughly the number of updates the lateral has received.- Returns:
- Returns the putCnt.
 
- 
getGetCnt- Returns:
- Returns the getCnt.
 
- 
getRemoveCnt- Returns:
- Returns the removeCnt.
 
- 
setCacheManager- Specified by:
- setCacheManagerin interface- ILateralCacheListener<K,- V> 
- Parameters:
- cacheMgr- The cacheMgr to set.
 
- 
getCacheManager- Specified by:
- getCacheManagerin interface- ILateralCacheListener<K,- V> 
- Returns:
- Returns the cacheMgr.
 
- 
setTcpLateralCacheAttributes- Parameters:
- tcpLateralCacheAttributes- The tcpLateralCacheAttributes to set.
 
- 
getTcpLateralCacheAttributes- Returns:
- Returns the tcpLateralCacheAttributes.
 
- 
shutdownShuts down the receiver.- Specified by:
- shutdownin interface- IShutdownObserver
 
 
-