org.apache.jcs.auxiliary.remote.server
Class RemoteCacheServerListener

java.lang.Object
  extended byorg.apache.jcs.auxiliary.remote.server.RemoteCacheServerListener
All Implemented Interfaces:
ICacheListener, IRemoteCacheConstants, IRemoteCacheListener, java.rmi.Remote, java.io.Serializable

public class RemoteCacheServerListener
extends java.lang.Object
implements IRemoteCacheListener, IRemoteCacheConstants, java.io.Serializable

This listener class is for inter cache commumication.

Author:
asmuts
See Also:
Serialized Form

Field Summary
protected static CompositeCacheManager cacheMgr
          Description of the Field
protected static IRemoteCacheListener instance
          Description of the Field
protected  IRemoteCacheAttributes irca
          Description of the Field
private static org.apache.commons.logging.Log log
           
private  int puts
          Description of the Field
private  int removes
           
 
Fields inherited from interface org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener
CLIENT_LISTENER, SERVER_LISTENER
 
Fields inherited from interface org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants
REMOTE_ALLOW_CLUSTER_GET, REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_PORT, REMOTE_CACHE_SERVICE_VAL, REMOTE_LOCAL_CLUSTER_CONSISTENCY, TOMCAT_ON, TOMCAT_XML
 
Constructor Summary
protected RemoteCacheServerListener(IRemoteCacheAttributes irca)
          Only need one since it does work for all regions, just reference by multiple region names.
 
Method Summary
protected  void getCacheManager()
          Gets the cacheManager attribute of the RemoteCacheServerListener object
static IRemoteCacheListener getInstance(IRemoteCacheAttributes irca)
          Gets the instance attribute of the RemoteCacheServerListener class
 byte getListenerId()
          Gets the listenerId attribute of the RemoteCacheServerListener object
 int getRemoteType()
          Gets the remoteType attribute of the RemoteCacheServerListener object
 void handleDispose(java.lang.String cacheName)
          Description of the Method
 void handlePut(ICacheElement cb)
          Just remove the element since it has been updated elsewhere cd should be incomplete for faster transmission.
 void handleRemove(java.lang.String cacheName, java.io.Serializable key)
          Description of the Method
 void handleRemoveAll(java.lang.String cacheName)
          Description of the Method
 void setListenerId(byte id)
          let the remote cache set a listener_id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

cacheMgr

protected static transient CompositeCacheManager cacheMgr
Description of the Field


instance

protected static IRemoteCacheListener instance
Description of the Field


irca

protected IRemoteCacheAttributes irca
Description of the Field


puts

private int puts
Description of the Field


removes

private int removes
Constructor Detail

RemoteCacheServerListener

protected RemoteCacheServerListener(IRemoteCacheAttributes irca)
Only need one since it does work for all regions, just reference by multiple region names.

Parameters:
irca -
Method Detail

setListenerId

public void setListenerId(byte id)
                   throws java.io.IOException
let the remote cache set a listener_id. Since there is only one listerenr 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:
setListenerId in interface ICacheListener
Parameters:
id - The new listenerId value
Throws:
java.io.IOException

getListenerId

public byte getListenerId()
                   throws java.io.IOException
Gets the listenerId attribute of the RemoteCacheServerListener object

Specified by:
getListenerId in interface ICacheListener
Returns:
The listenerId value
Throws:
java.io.IOException

getRemoteType

public int getRemoteType()
                  throws java.io.IOException
Gets the remoteType attribute of the RemoteCacheServerListener object

Specified by:
getRemoteType in interface IRemoteCacheListener
Returns:
The remoteType value
Throws:
java.io.IOException

getInstance

public static IRemoteCacheListener getInstance(IRemoteCacheAttributes irca)
Gets the instance attribute of the RemoteCacheServerListener class

Returns:
The instance value

handlePut

public void handlePut(ICacheElement cb)
               throws java.io.IOException
Just 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

Specified by:
handlePut in interface ICacheListener
Throws:
java.io.IOException

handleRemove

public void handleRemove(java.lang.String cacheName,
                         java.io.Serializable key)
                  throws java.io.IOException
Description of the Method

Specified by:
handleRemove in interface ICacheListener
Throws:
java.io.IOException

handleRemoveAll

public void handleRemoveAll(java.lang.String cacheName)
                     throws java.io.IOException
Description of the Method

Specified by:
handleRemoveAll in interface ICacheListener
Throws:
java.io.IOException

handleDispose

public void handleDispose(java.lang.String cacheName)
                   throws java.io.IOException
Description of the Method

Specified by:
handleDispose in interface ICacheListener
Throws:
java.io.IOException

getCacheManager

protected void getCacheManager()
Gets the cacheManager attribute of the RemoteCacheServerListener object