Class RemoteCacheNoWait<K,V> 
- All Implemented Interfaces:
- AuxiliaryCache<K,,- V> - ICache<K,,- V> - ICacheType
Used to queue up update requests to the underlying cache. These requests will be processed in their order of arrival via the cache event queue processor.
Typically errors will be handled down stream. We only need to kill the queue if an error makes it to this level from the queue. That can only happen if the queue is damaged, since the events are Processed asynchronously.
There is no reason to create a queue on startup if the remote is not healthy.
If the remote cache encounters an error it will zombie--create a balking facade for the service. The Zombie will queue up items until the connection is restored. An alternative way to accomplish the same thing would be to stop, not destroy the queue at this level. That way items would be added to the queue and then when the connection is restored, we could start the worker threads again. This is a better long term solution, but it requires some significant changes to the complicated worker queues.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheTypeICacheType.CacheType
- 
Field SummaryFields inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheNAME_COMPONENT_DELIMITER
- 
Constructor SummaryConstructorsConstructorDescriptionRemoteCacheNoWait(IRemoteCacheClient<K, V> cache) Constructs with the given remote cache, and fires up an event queue for asynchronous processing.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispose()Adds a dispose request to the remote cache.voidfixCache(ICacheServiceNonLocal<?, ?> remote) Replaces the remote cache service handle with the given handle and reset the event queue by starting up a new instance.Synchronously reads from the remote cache.This returns the generic attributes for an auxiliary cache.protected ICacheEventQueue<K,V> This is for testing only.Gets the cacheName attribute of the RemoteCacheNoWait objectNo remote invocation.this won't be called since we don't do ICache logging here.Return the keys in this cache.Map<K,ICacheElement<K, V>> getMatching(String pattern) Gets items from the cache matching the given pattern.Map<K,ICacheElement<K, V>> getMultiple(Set<K> keys) Gets multiple items from the cache based on the given set of keys.protected IRemoteCacheClient<K,V> This is temporary.intgetSize()No remote invocation.getStats()Returns the statistics in String form.Returns the async cache status.booleanAdds a remove request to the remote cache.voidAdds a removeAll request to the remote cache.voidResets the event q by first destroying the existing one and starting up new one.toString()Returns the stats and the cache.toString().voidupdate(ICacheElement<K, V> element) Adds a put event to the queue.Methods inherited from class org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCachecreateICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, processGetMultiple, setCacheEventLogger, setElementSerializer, setKeyMatcher
- 
Constructor Details- 
RemoteCacheNoWaitConstructs with the given remote cache, and fires up an event queue for asynchronous processing.- Parameters:
- cache-
 
 
- 
- 
Method Details- 
updateAdds a put event to the queue.- Parameters:
- element-
- Throws:
- IOException
 
- 
getSynchronously reads from the remote cache.- Specified by:
- getin interface- ICache<K,- V> 
- Specified by:
- getin class- AbstractAuxiliaryCache<K,- V> 
- Parameters:
- key-
- Returns:
- element from the remote cache, or null if not present
- Throws:
- IOException
 
- 
getMatchingDescription copied from interface:ICacheGets items from the cache matching the given pattern. Items from memory will replace those from remote sources. This only works with string keys. It's too expensive to do a toString on every key. Auxiliaries will do their best to handle simple expressions. For instance, the JDBC disk cache will convert * to % and . to _- Parameters:
- pattern-
- Returns:
- Map
- Throws:
- IOException
 
- 
getMultipleGets multiple items from the cache based on the given set of keys. Sends the getMultiple request on to the server rather than looping through the requested keys.- Parameters:
- keys-
- Returns:
- a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache for any of these keys
- Throws:
- IOException
 
- 
getKeySetReturn the keys in this cache.- 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:
 
- 
removeAdds a remove request to the remote cache.- Parameters:
- key-
- Returns:
- if this was successful
- Throws:
- IOException
 
- 
removeAllAdds a removeAll request to the remote cache.- Throws:
- IOException
 
- 
disposeAdds a dispose request to the remote cache.
- 
getSizeNo remote invocation.- Returns:
- The size value
 
- 
getCacheTypeNo remote invocation.- Returns:
- The cacheType value
 
- 
getStatusReturns the async cache status. An error status indicates either the remote connection is not available, or the asyn queue has been unexpectedly destroyed. No remote invocation.- Returns:
- The status value
 
- 
getCacheNameGets the cacheName attribute of the RemoteCacheNoWait object- Returns:
- The cacheName value
 
- 
fixCacheReplaces the remote cache service handle with the given handle and reset the event queue by starting up a new instance.- Parameters:
- remote-
 
- 
resetEventQResets the event q by first destroying the existing one and starting up new one.There may be no good reason to kill the existing queue. We will sometimes need to set a new listener id, so we should create a new queue. We should let the old queue drain. If we were Connected to the failover, it would be best to finish sending items. 
- 
getRemoteCacheThis is temporary. It allows the manager to get the lister.- Returns:
- the instance of the remote cache client used by this object
 
- 
getAuxiliaryCacheAttributesDescription copied from interface:AuxiliaryCacheThis returns the generic attributes for an auxiliary cache. Most implementations will cast this to a more specific type.- Returns:
- Returns the AuxiliaryCacheAttributes.
 
- 
getCacheEventQueueThis is for testing only. It allows you to take a look at the event queue.- Returns:
- ICacheEventQueue
 
- 
toStringReturns the stats and the cache.toString().
- 
getStatsReturns the statistics in String form.- Returns:
- String
 
- 
getStatistics- Returns:
- statistics about this communication
 
- 
getEventLoggingExtraInfothis won't be called since we don't do ICache logging here.- Specified by:
- getEventLoggingExtraInfoin class- AbstractAuxiliaryCache<K,- V> 
- Returns:
- String
 
 
-