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

java.lang.Object
  extended byorg.apache.jcs.auxiliary.remote.server.RemoteCacheClusterManager
All Implemented Interfaces:
ICacheManager, ICacheType, java.io.Serializable

public class RemoteCacheClusterManager
extends java.lang.Object
implements ICacheManager

Author:
asmuts
See Also:
Serialized Form

Nested Class Summary
private static class RemoteCacheClusterManager.Location
          Location of the RMI registry.
 
Field Summary
(package private)  java.util.Map caches
           
private  int clients
           
(package private)  java.lang.String host
           
(package private) static java.util.Map instances
           
private  IRemoteCacheAttributes irca
           
private static org.apache.commons.logging.Log log
           
private static RemoteCacheClusterMonitor monitor
           
(package private)  int port
           
private  IRemoteCacheService remoteService
          Handle to the remote cache service; or a zombie handle if failed to connect.
private  RemoteCacheWatchRepairable remoteWatch
          Wrapper of the remote cache watch service; or wrapper of a zombie service if failed to connect.
(package private)  java.lang.String service
           
 
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE
 
Constructor Summary
private RemoteCacheClusterManager(java.lang.String host, int port, java.lang.String service)
          Constructs an instance to with the given remote connection parameters.
 
Method Summary
 void addRemoteCacheListener(IRemoteCacheAttributes cattr, IRemoteCacheListener listener)
          Adds the remote cache listener to the underlying cache-watch service.
 void fixCaches(IRemoteCacheService remoteService, IRemoteCacheObserver remoteWatch)
          Fixes up all the caches managed by this cache manager.
 void freeCache(java.lang.String name)
          Description of the Method
 ICache getCache(IRemoteCacheAttributes cattr)
          Gets the cache attribute of the RemoteCacheClusterManager object
 ICache getCache(java.lang.String cacheName)
          Returns a remote cache for the given cache name.
 int getCacheType()
          Gets the cacheType attribute of the RemoteCacheClusterManager object
 IRemoteCacheAttributes getDefaultCattr()
          Gets the defaultCattr attribute of the RemoteCacheClusterManager object
static RemoteCacheClusterManager getInstance(IRemoteCacheAttributes cattr)
          Returns an instance of RemoteCacheManager for the given connection parameters.
 void release()
          Description of the Method
 
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

instances

static final java.util.Map instances

monitor

private static RemoteCacheClusterMonitor monitor

clients

private int clients

caches

final java.util.Map caches

host

final java.lang.String host

port

final int port

service

final java.lang.String service

irca

private IRemoteCacheAttributes irca

remoteService

private IRemoteCacheService remoteService
Handle to the remote cache service; or a zombie handle if failed to connect.


remoteWatch

private RemoteCacheWatchRepairable remoteWatch
Wrapper of the remote cache watch service; or wrapper of a zombie service if failed to connect.

Constructor Detail

RemoteCacheClusterManager

private RemoteCacheClusterManager(java.lang.String host,
                                  int port,
                                  java.lang.String service)
Constructs an instance to with the given remote connection parameters. If the connection cannot be made, "zombie" services will be temporarily used until a successful re-connection is made by the monitoring daemon.

Parameters:
host -
port -
service -
Method Detail

getDefaultCattr

public IRemoteCacheAttributes getDefaultCattr()
Gets the defaultCattr attribute of the RemoteCacheClusterManager object

Returns:
The defaultCattr value

addRemoteCacheListener

public void addRemoteCacheListener(IRemoteCacheAttributes cattr,
                                   IRemoteCacheListener listener)
                            throws java.io.IOException
Adds the remote cache listener to the underlying cache-watch service.

Parameters:
cattr - The feature to be added to the RemoteCacheListener attribute
listener - The feature to be added to the RemoteCacheListener attribute
Throws:
java.io.IOException

getInstance

public static RemoteCacheClusterManager getInstance(IRemoteCacheAttributes cattr)
Returns an instance of RemoteCacheManager for the given connection parameters. Also starts up the monitoring daemon, if not already started. If the connection cannot be established, zombie objects will be used for future recovery purposes.

Returns:
The instance value

getCache

public ICache getCache(java.lang.String cacheName)
Returns a remote cache for the given cache name.

Specified by:
getCache in interface ICacheManager
Returns:
The cache value

getCache

public ICache getCache(IRemoteCacheAttributes cattr)
Gets the cache attribute of the RemoteCacheClusterManager object

Returns:
The cache value

freeCache

public void freeCache(java.lang.String name)
               throws java.io.IOException
Description of the Method

Throws:
java.io.IOException

release

public void release()
Description of the Method


fixCaches

public void fixCaches(IRemoteCacheService remoteService,
                      IRemoteCacheObserver remoteWatch)
Fixes up all the caches managed by this cache manager.


getCacheType

public int getCacheType()
Gets the cacheType attribute of the RemoteCacheClusterManager object

Specified by:
getCacheType in interface ICacheType
Returns:
The cacheType value