public class LateralTCPListener extends java.lang.Object implements ILateralCacheListener, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
LateralTCPListener.ConnectionHandler
A Separate thread taht runs when a command comes into the LateralTCPReceiver.
|
class |
LateralTCPListener.ListenerThread
Processes commands from the server socket.
|
Modifier and Type | Field and Description |
---|---|
protected static java.util.HashMap |
instances
Map of available instances, keyed by port
|
Modifier | Constructor and Description |
---|---|
protected |
LateralTCPListener(ITCPLateralCacheAttributes ilca)
Only need one since it does work for all regions, just reference by multiple region names.
|
Modifier and Type | Method and Description |
---|---|
protected CompositeCache |
getCache(java.lang.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(java.lang.String cacheName)
Right now this does nothing.
|
java.io.Serializable |
handleGet(java.lang.String cacheName,
java.io.Serializable key)
Gets the cache that was injected by the lateral factory.
|
java.util.Map |
handleGetMatching(java.lang.String cacheName,
java.lang.String pattern)
Gets the cache that was injected by the lateral factory.
|
void |
handlePut(ICacheElement element)
Increments the put count.
|
void |
handleRemove(java.lang.String cacheName,
java.io.Serializable key)
Increments the remove count.
|
void |
handleRemoveAll(java.lang.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) |
protected static final java.util.HashMap instances
protected LateralTCPListener(ITCPLateralCacheAttributes ilca)
ilca
- public static ILateralCacheListener getInstance(ITCPLateralCacheAttributes ilca, ICompositeCacheManager cacheMgr)
ilca
- ITCPLateralCacheAttributescacheMgr
- public void init()
init
in interface ILateralCacheListener
public void setListenerId(long id) throws java.io.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 valuejava.io.IOException
public long getListenerId() throws java.io.IOException
getListenerId
in interface ICacheListener
java.io.IOException
public void handlePut(ICacheElement element) throws java.io.IOException
handlePut
in interface ICacheListener
java.io.IOException
ICacheListener.handlePut(org.apache.jcs.engine.behavior.ICacheElement)
public void handleRemove(java.lang.String cacheName, java.io.Serializable key) throws java.io.IOException
handleRemove
in interface ICacheListener
java.io.IOException
ICacheListener.handleRemove(java.lang.String,
java.io.Serializable)
public void handleRemoveAll(java.lang.String cacheName) throws java.io.IOException
handleRemoveAll
in interface ICacheListener
java.io.IOException
ICacheListener.handleRemoveAll(java.lang.String)
public java.io.Serializable handleGet(java.lang.String cacheName, java.io.Serializable key) throws java.io.IOException
cacheName
- key
- java.io.IOException
public java.util.Map handleGetMatching(java.lang.String cacheName, java.lang.String pattern) throws java.io.IOException
cacheName
- pattern
- java.io.IOException
public void handleDispose(java.lang.String cacheName) throws java.io.IOException
handleDispose
in interface ICacheListener
java.io.IOException
ICacheListener.handleDispose(java.lang.String)
protected CompositeCache getCache(java.lang.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()
Copyright © 2002-2013 Apache Software Foundation. All Rights Reserved.