public class LateralTCPListener<K,V> extends Object implements ILateralCacheListener<K,V>, IShutdownObserver
Modifier and Type | Class and Description |
---|---|
class |
LateralTCPListener.ConnectionHandler
Deprecated.
No longer used
|
class |
LateralTCPListener.ListenerThread
Deprecated.
No longer used
|
Modifier | Constructor and Description |
---|---|
protected |
LateralTCPListener(ITCPLateralCacheAttributes ilca)
Deprecated.
Specify serializer
|
protected |
LateralTCPListener(ITCPLateralCacheAttributes ilca,
IElementSerializer serializer)
Only need one since it does work for all regions, just reference by multiple region names.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Dispose this listener
|
protected CompositeCache<K,V> |
getCache(String name)
Gets the cacheManager attribute of the LateralCacheTCPListener object.
|
ICompositeCacheManager |
getCacheManager() |
int |
getGetCnt() |
static <K,V> LateralTCPListener<K,V> |
getInstance(ITCPLateralCacheAttributes ilca,
ICompositeCacheManager cacheMgr)
Deprecated.
Specify serializer
|
static <K,V> LateralTCPListener<K,V> |
getInstance(ITCPLateralCacheAttributes ilca,
ICompositeCacheManager cacheMgr,
IElementSerializer serializer)
Gets the instance attribute of the LateralCacheTCPListener class.
|
long |
getListenerId()
Gets the listenerId attribute of the LateralCacheTCPListener object
|
int |
getPutCnt()
This is roughly the number of updates the lateral has received.
|
int |
getRemoveCnt() |
ITCPLateralCacheAttributes |
getTcpLateralCacheAttributes() |
void |
handleDispose(String cacheName)
This marks this instance as terminated.
|
ICacheElement<K,V> |
handleGet(String cacheName,
K key)
Gets the cache that was injected by the lateral factory.
|
Set<K> |
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.
|
void |
handlePut(ICacheElement<K,V> element)
Increments the put count.
|
void |
handleRemove(String cacheName,
K key)
Increments the remove count.
|
void |
handleRemoveAll(String cacheName)
Gets the cache that was injected by the lateral factory.
|
void |
init()
This starts the ListenerThread on the specified port.
|
void |
setCacheManager(ICompositeCacheManager cacheMgr) |
void |
setListenerId(long id)
Let the lateral cache set a listener_id.
|
void |
setTcpLateralCacheAttributes(ITCPLateralCacheAttributes tcpLateralCacheAttributes) |
void |
shutdown()
Shuts down the receiver.
|
@Deprecated protected LateralTCPListener(ITCPLateralCacheAttributes ilca)
ilca
- ITCPLateralCacheAttributesprotected LateralTCPListener(ITCPLateralCacheAttributes ilca, IElementSerializer serializer)
ilca
- ITCPLateralCacheAttributesserializer
- the serializer to use when receiving@Deprecated public static <K,V> LateralTCPListener<K,V> getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr)
ilca
- ITCPLateralCacheAttributescacheMgr
- public static <K,V> LateralTCPListener<K,V> getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr, IElementSerializer serializer)
ilca
- ITCPLateralCacheAttributescacheMgr
- serializer
- the serializer to use when receivingpublic void init()
init
in interface ILateralCacheListener<K,V>
public void setListenerId(long id) throws IOException
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.
setListenerId
in interface ICacheListener<K,V>
id
- The new listenerId valueIOException
public long getListenerId() throws IOException
getListenerId
in interface ICacheListener<K,V>
IOException
public void handlePut(ICacheElement<K,V> element) throws IOException
handlePut
in interface ICacheListener<K,V>
IOException
ICacheListener.handlePut(org.apache.commons.jcs3.engine.behavior.ICacheElement)
public void handleRemove(String cacheName, K key) throws IOException
handleRemove
in interface ICacheListener<K,V>
IOException
ICacheListener.handleRemove(String,
Object)
public void handleRemoveAll(String cacheName) throws IOException
handleRemoveAll
in interface ICacheListener<K,V>
IOException
ICacheListener.handleRemoveAll(String)
public ICacheElement<K,V> handleGet(String cacheName, K key) throws IOException
cacheName
- key
- IOException
public Map<K,ICacheElement<K,V>> handleGetMatching(String cacheName, String pattern) throws IOException
cacheName
- the name of the cachepattern
- the matching patternIOException
public Set<K> handleGetKeySet(String cacheName) throws IOException
cacheName
- the name of the cacheIOException
public void handleDispose(String cacheName) throws IOException
handleDispose
in interface ICacheListener<K,V>
IOException
ICacheListener.handleDispose(String)
public void dispose()
ILateralCacheListener
dispose
in interface ILateralCacheListener<K,V>
protected CompositeCache<K,V> getCache(String name)
Normally this is set by the factory. If it wasn't set the listener defaults to the expected singleton behavior of the cache manager.
name
- public int getPutCnt()
public int getGetCnt()
public int getRemoveCnt()
public void setCacheManager(ICompositeCacheManager cacheMgr)
setCacheManager
in interface ILateralCacheListener<K,V>
cacheMgr
- The cacheMgr to set.public ICompositeCacheManager getCacheManager()
getCacheManager
in interface ILateralCacheListener<K,V>
public void setTcpLateralCacheAttributes(ITCPLateralCacheAttributes tcpLateralCacheAttributes)
tcpLateralCacheAttributes
- The tcpLateralCacheAttributes to set.public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
public void shutdown()
shutdown
in interface IShutdownObserver
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.