Class RemoteCacheManager
java.lang.Object
org.apache.commons.jcs3.auxiliary.remote.RemoteCacheManager
An instance of RemoteCacheManager corresponds to one remote connection of a specific host and
port. All RemoteCacheManager instances are monitored by the singleton RemoteCacheMonitor
monitoring daemon for error detection and recovery.
Getting an instance of the remote cache has the effect of getting a handle on the remote server. Listeners are not registered with the server until a cache is requested from the manager.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RemoteCacheManager
(IRemoteCacheAttributes cattr, ICompositeCacheManager cacheMgr, RemoteCacheMonitor monitor, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer) Constructs an instance to with the given remote connection parameters. -
Method Summary
Modifier and TypeMethodDescription<K,
V> void addRemoteCacheListener
(IRemoteCacheAttributes cattr, IRemoteCacheListener<K, V> listener) Adds the remote cache listener to the underlying cache-watch service.boolean
Returns true if the connection to the remote host can be successfully re-established.void
Fixes up all the caches managed by this cache manager.<K,
V> RemoteCacheNoWait<K, V> getCache
(IRemoteCacheAttributes cattr) Gets a RemoteCacheNoWait from the RemoteCacheManager.protected void
Lookup remote service from registryprotected <K,
V> RemoteCacheNoWait<K, V> Create new RemoteCacheNoWait instancevoid
release()
Shutdown all.void
Removes a listener.
-
Constructor Details
-
RemoteCacheManager
protected RemoteCacheManager(IRemoteCacheAttributes cattr, ICompositeCacheManager cacheMgr, RemoteCacheMonitor monitor, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer) 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:
cattr
- cache attributescacheMgr
- the cache hubmonitor
- the cache monitor thread for error notificationscacheEventLogger
-elementSerializer
-
-
-
Method Details
-
lookupRemoteService
Lookup remote service from registry- Throws:
IOException
- if the remote service could not be found
-
addRemoteCacheListener
public <K,V> void addRemoteCacheListener(IRemoteCacheAttributes cattr, IRemoteCacheListener<K, V> listener) throws IOExceptionAdds the remote cache listener to the underlying cache-watch service.- Parameters:
cattr
- The feature to be added to the RemoteCacheListener attributelistener
- The feature to be added to the RemoteCacheListener attribute- Throws:
IOException
-
removeRemoteCacheListener
Removes a listener. When the primary recovers the failover must deregister itself for a region. The failover runner will call this method to de-register. We do not want to deregister all listeners to a remote server, in case a failover is a primary of another region. Having one regions failover act as another servers primary is not currently supported.- Parameters:
cattr
-- Throws:
IOException
-
getCache
Gets a RemoteCacheNoWait from the RemoteCacheManager. The RemoteCacheNoWait objects are identified by the cache name value of the RemoteCacheAttributes object.If the client is configured to register a listener, this call results on a listener being created if one isn't already registered with the remote cache for this region.
- Parameters:
cattr
-- Returns:
- The cache value
-
newRemoteCacheNoWait
Create new RemoteCacheNoWait instance- Parameters:
cattr
- the cache configuration- Returns:
- the instance
-
release
Shutdown all. -
fixCaches
Fixes up all the caches managed by this cache manager. -
canFixCaches
Returns true if the connection to the remote host can be successfully re-established.- Returns:
- true if we found a failover server
-