Class AbstractRemoteAuxiliaryCache<K,V> 
java.lang.Object
org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCache<K,V>
 
org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheEventLogging<K,V>
 
org.apache.commons.jcs3.auxiliary.remote.AbstractRemoteAuxiliaryCache<K,V> 
- All Implemented Interfaces:
- AuxiliaryCache<K,,- V> - IRemoteCacheClient<K,,- V> - ICache<K,,- V> - ICacheType
- Direct Known Subclasses:
- RemoteCache,- RemoteHttpCache
public abstract class AbstractRemoteAuxiliaryCache<K,V> 
extends AbstractAuxiliaryCacheEventLogging<K,V>
implements IRemoteCacheClient<K,V>  
Abstract base for remote caches. I'm trying to break out and reuse common functionality.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheTypeICacheType.CacheType
- 
Field SummaryFieldsFields inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheNAME_COMPONENT_DELIMITER
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractRemoteAuxiliaryCache(IRemoteCacheAttributes cattr, ICacheServiceNonLocal<K, V> remote, IRemoteCacheListener<K, V> listener) Creates the base.
- 
Method SummaryModifier and TypeMethodDescriptionvoidfixCache(ICacheServiceNonLocal<?, ?> restoredRemote) Replaces the current remote cache service handle with the given handle.This returns the generic attributes for an auxiliary cache.Gets the cacheName attribute of the RemoteCache object.Gets the cacheType attribute of the RemoteCache objectReturn the keys in this cache.Allows other member of this package to access the listener.longGets the listenerId attribute of the RemoteCacheListener objectprotected IRemoteCacheAttributesprotected IRemoteCacheListener<K,V> protected ICacheServiceNonLocal<K,V> intgetSize()Returns the current cache size.getStats()Gets the stats attribute of the RemoteCache object.Returns the cache status.getUsingPool(K key) This allows gets to timeout in case of remote server machine shutdown.protected abstract voidhandleException(Exception ex, String msg, String eventName) Custom exception handling some children.protected voidSynchronously dispose the remote cache; if failed, replace the remote handle with a zombie.protected ICacheElement<K,V> processGet(K key) Synchronously get from the remote cache; if failed, replace the remote handle with a zombie.Map<K,ICacheElement<K, V>> processGetMatching(String pattern) Calls get matching on the server.protected booleanprocessRemove(K key) Synchronously remove from the remote cache; if failed, replace the remote handle with a zombie.protected voidSynchronously removeAll from the remote cache; if failed, replace the remote handle with a zombie.protected voidprocessUpdate(ICacheElement<K, V> ce) Serializes the object and then calls update on the remote server with the byte array.voidsetListenerId(long id) let the remote cache set a listener_id.protected voidsetRemoteCacheAttributes(IRemoteCacheAttributes remoteCacheAttributes) protected voidsetRemoteCacheListener(IRemoteCacheListener<K, V> remoteCacheListener) protected voidsetRemoteCacheService(ICacheServiceNonLocal<K, V> remote) Methods inherited from class org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheEventLoggingdispose, disposeWithEventLogging, get, getMatching, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, remove, removeAll, removeAllWithEventLogging, removeWithEventLogging, update, updateWithEventLoggingMethods inherited from class org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCachecreateICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getEventLoggingExtraInfo, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, processGetMultiple, setCacheEventLogger, setElementSerializer, setKeyMatcherMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.jcs3.auxiliary.AuxiliaryCachesetCacheEventLogger, setElementSerializerMethods inherited from interface org.apache.commons.jcs3.engine.behavior.ICachedispose, get, getMatching, getMultiple, remove, removeAll, setKeyMatcher, update
- 
Field Details- 
cacheNameThe cacheName
 
- 
- 
Constructor Details- 
AbstractRemoteAuxiliaryCachepublic AbstractRemoteAuxiliaryCache(IRemoteCacheAttributes cattr, ICacheServiceNonLocal<K, V> remote, IRemoteCacheListener<K, V> listener) Creates the base.- Parameters:
- cattr-
- remote-
- listener-
 
 
- 
- 
Method Details- 
processDisposeSynchronously dispose the remote cache; if failed, replace the remote handle with a zombie.- Specified by:
- processDisposein class- AbstractAuxiliaryCacheEventLogging<K,- V> 
- Throws:
- IOException
 
- 
processGetSynchronously get from the remote cache; if failed, replace the remote handle with a zombie.Use threadpool to timeout if a value is set for GetTimeoutMillis If we are a cluster client, we need to leave the Element in its serialized form. Cluster clients cannot deserialize objects. Cluster clients get ICacheElementSerialized objects from other remote servers. - Specified by:
- processGetin class- AbstractAuxiliaryCacheEventLogging<K,- V> 
- Parameters:
- key-
- Returns:
- ICacheElement, a wrapper around the key, value, and attributes
- Throws:
- IOException
 
- 
getUsingPoolThis allows gets to timeout in case of remote server machine shutdown.- Parameters:
- key-
- Returns:
- ICacheElement
- Throws:
- IOException
 
- 
processGetMatchingCalls get matching on the server. Each entry in the result is unwrapped.- Specified by:
- processGetMatchingin class- AbstractAuxiliaryCacheEventLogging<K,- V> 
- Parameters:
- pattern-
- Returns:
- Map
- Throws:
- IOException
 
- 
processRemoveSynchronously remove from the remote cache; if failed, replace the remote handle with a zombie.- Specified by:
- processRemovein class- AbstractAuxiliaryCacheEventLogging<K,- V> 
- Parameters:
- key-
- Returns:
- boolean, whether or not the item was removed
- Throws:
- IOException
 
- 
processRemoveAllSynchronously removeAll from the remote cache; if failed, replace the remote handle with a zombie.- Specified by:
- processRemoveAllin class- AbstractAuxiliaryCacheEventLogging<K,- V> 
- Throws:
- IOException
 
- 
processUpdateSerializes the object and then calls update on the remote server with the byte array. The byte array is wrapped in a ICacheElementSerialized. This allows the remote server to operate without any knowledge of caches classes.- Specified by:
- processUpdatein class- AbstractAuxiliaryCacheEventLogging<K,- V> 
- Parameters:
- ce-
- Throws:
- IOException
 
- 
getKeySetReturn the keys in this cache.- Specified by:
- getKeySetin interface- AuxiliaryCache<K,- V> 
- Returns:
- a set of the key type TODO This should probably be done in chunks with a range passed in. This will be a problem if someone puts a 1,000,000 or so items in a region.
- Throws:
- IOException- if access to the auxiliary cache fails
- See Also:
 
- 
getListenerAllows other member of this package to access the listener. This is mainly needed for deregistering a listener.- Specified by:
- getListenerin interface- IRemoteCacheClient<K,- V> 
- Returns:
- IRemoteCacheListener, the listener for this remote server
 
- 
setListenerIdlet the remote cache set a listener_id. Since there is only one listener 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.- Parameters:
- id- The new listenerId value
 
- 
getListenerIdGets the listenerId attribute of the RemoteCacheListener object- Specified by:
- getListenerIdin interface- IRemoteCacheClient<K,- V> 
- Returns:
- The listenerId value
 
- 
getSizeReturns the current cache size.
- 
handleExceptionprotected abstract void handleException(Exception ex, String msg, String eventName) throws IOException Custom exception handling some children. This should be used to initiate failover.- Parameters:
- ex-
- msg-
- eventName-
- Throws:
- IOException
 
- 
getStatsGets the stats attribute of the RemoteCache object.
- 
getStatistics- Specified by:
- getStatisticsin interface- AuxiliaryCache<K,- V> 
- Returns:
- IStats object
 
- 
getStatusReturns the cache status. An error status indicates the remote connection is not available.
- 
fixCacheReplaces the current remote cache service handle with the given handle. If the current remote is a Zombie, then it propagates any events that are queued to the restored service.- Specified by:
- fixCachein interface- IRemoteCacheClient<K,- V> 
- Parameters:
- restoredRemote- ICacheServiceNonLocal -- the remote server or proxy to the remote server
 
- 
getCacheTypeGets the cacheType attribute of the RemoteCache object- Specified by:
- getCacheTypein interface- ICacheType
- Returns:
- The cacheType value
 
- 
getCacheNameGets the cacheName attribute of the RemoteCache object.- Specified by:
- getCacheNamein interface- ICache<K,- V> 
- Returns:
- The cacheName value
 
- 
setRemoteCacheService- Parameters:
- remote- the remote to set
 
- 
getRemoteCacheService- Returns:
- the remote
 
- 
getAuxiliaryCacheAttributesDescription copied from interface:AuxiliaryCacheThis returns the generic attributes for an auxiliary cache. Most implementations will cast this to a more specific type.- Specified by:
- getAuxiliaryCacheAttributesin interface- AuxiliaryCache<K,- V> 
- Returns:
- Returns the AuxiliaryCacheAttributes.
 
- 
setRemoteCacheAttributes- Parameters:
- remoteCacheAttributes- the remoteCacheAttributes to set
 
- 
getRemoteCacheAttributes- Returns:
- the remoteCacheAttributes
 
- 
setRemoteCacheListener- Parameters:
- remoteCacheListener- the remoteCacheListener to set
 
- 
getRemoteCacheListener- Returns:
- the remoteCacheListener
 
 
-