|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPListener
public class LateralTCPListener
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 Summary | |
---|---|
class |
LateralTCPListener.ConnectionHandler
A Separate thread taht runs when a command comes into the LateralTCPReceiver. |
class |
LateralTCPListener.ListenerThread
Processes commands from the server socket. |
Field Summary | |
---|---|
protected static HashMap |
instances
Map of available instances, keyed by port |
Constructor Summary | |
---|---|
protected |
LateralTCPListener(ITCPLateralCacheAttributes ilca)
Only need one since it does work for all regions, just reference by multiple region names. |
Method Summary | |
---|---|
protected CompositeCache |
getCache(String name)
Gets the cacheManager attribute of the LateralCacheTCPListener object. |
ICompositeCacheManager |
getCacheManager()
|
int |
getGetCnt()
|
static ILateralCacheListener |
getInstance(ITCPLateralCacheAttributes ilca,
ICompositeCacheManager cacheMgr)
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)
Right now this does nothing. |
Serializable |
handleGet(String cacheName,
Serializable key)
Gets the cache that was injected by the lateral factory. |
Map |
handleGetMatching(String cacheName,
String pattern)
Gets the cache that was injected by the lateral factory. |
void |
handlePut(ICacheElement element)
Increments the put count. |
void |
handleRemove(String cacheName,
Serializable 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final HashMap instances
Constructor Detail |
---|
protected LateralTCPListener(ITCPLateralCacheAttributes ilca)
ilca
- Method Detail |
---|
public static ILateralCacheListener getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr)
ilca
- ITCPLateralCacheAttributescacheMgr
-
public void init()
init
in interface ILateralCacheListener
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
id
- The new listenerId value
IOException
public long getListenerId() throws IOException
getListenerId
in interface ICacheListener
IOException
public void handlePut(ICacheElement element) throws IOException
handlePut
in interface ICacheListener
IOException
ICacheListener.handlePut(org.apache.jcs.engine.behavior.ICacheElement)
public void handleRemove(String cacheName, Serializable key) throws IOException
handleRemove
in interface ICacheListener
IOException
ICacheListener.handleRemove(java.lang.String,
java.io.Serializable)
public void handleRemoveAll(String cacheName) throws IOException
handleRemoveAll
in interface ICacheListener
IOException
ICacheListener.handleRemoveAll(java.lang.String)
public Serializable handleGet(String cacheName, Serializable key) throws IOException
cacheName
- key
-
IOException
public Map handleGetMatching(String cacheName, String pattern) throws IOException
cacheName
- pattern
-
IOException
public void handleDispose(String cacheName) throws IOException
handleDispose
in interface ICacheListener
IOException
ICacheListener.handleDispose(java.lang.String)
protected CompositeCache 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 amanger.
name
-
public int getPutCnt()
public int getGetCnt()
public int getRemoveCnt()
public void setCacheManager(ICompositeCacheManager cacheMgr)
setCacheManager
in interface ILateralCacheListener
cacheMgr
- The cacheMgr to set.public ICompositeCacheManager getCacheManager()
getCacheManager
in interface ILateralCacheListener
public void setTcpLateralCacheAttributes(ITCPLateralCacheAttributes tcpLateralCacheAttributes)
tcpLateralCacheAttributes
- The tcpLateralCacheAttributes to set.public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
public void shutdown()
shutdown
in interface IShutdownObserver
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |