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 remote cache commumication.

See Also:
Serialized Form

Field Summary
protected static CompositeCacheManager cacheMgr
          The hub, the cache manager, the master controller .
protected static IRemoteCacheListener instance
          Singleton instance of the listener
protected  IRemoteCacheAttributes irca
          Remote cache configuration attributes.
 
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
 long 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)
          Calls freeCache on the named region.
 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)
          Calls remove for the key on the named cache
 void handleRemoveAll(java.lang.String cacheName)
          Calls removeAl on the named cache region.
 void setListenerId(long 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

cacheMgr

protected static transient CompositeCacheManager cacheMgr
The hub, the cache manager, the master controller . . .


instance

protected static IRemoteCacheListener instance
Singleton instance of the listener


irca

protected IRemoteCacheAttributes irca
Remote cache configuration attributes.

Constructor Detail

RemoteCacheServerListener

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

Exports this remote object to make it available to receive incoming calls, using an anonymous port if none is specified.

Parameters:
irca - the atttributes, the LocalPort specifies the receiving port.
Method Detail

setListenerId

public void setListenerId(long 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 IRemoteCacheListener
Parameters:
id - The new listenerId value
Throws:
java.io.IOException

getListenerId

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

Specified by:
getListenerId in interface IRemoteCacheListener
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

Parameters:
irca -
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
Parameters:
cb -
Throws:
java.io.IOException

handleRemove

public void handleRemove(java.lang.String cacheName,
                         java.io.Serializable key)
                  throws java.io.IOException
Calls remove for the key on the named cache

Specified by:
handleRemove in interface ICacheListener
Parameters:
cacheName -
key -
Throws:
java.io.IOException

handleRemoveAll

public void handleRemoveAll(java.lang.String cacheName)
                     throws java.io.IOException
Calls removeAl on the named cache region.

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

handleDispose

public void handleDispose(java.lang.String cacheName)
                   throws java.io.IOException
Calls freeCache on the named region.

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

getCacheManager

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



Copyright © 2002-2007 Apache Software Foundation. All Rights Reserved.