public class RemoteCacheNoWait<K,V> extends AbstractAuxiliaryCache<K,V>
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.
ICacheType.CacheType
Constructor and Description |
---|
RemoteCacheNoWait(IRemoteCacheClient<K,V> cache)
Constructs with the given remote cache, and fires up an event queue for asynchronous
processing.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Adds a dispose request to the remote cache.
|
void |
fixCache(ICacheServiceNonLocal<?,?> remote)
Replaces the remote cache service handle with the given handle and reset the event queue by
starting up a new instance.
|
ICacheElement<K,V> |
get(K key)
Synchronously reads from the remote cache.
|
AuxiliaryCacheAttributes |
getAuxiliaryCacheAttributes()
This returns the generic attributes for an auxiliary cache.
|
protected ICacheEventQueue<K,V> |
getCacheEventQueue()
This is for testing only.
|
String |
getCacheName()
Gets the cacheName attribute of the RemoteCacheNoWait object
|
ICacheType.CacheType |
getCacheType()
No remote invocation.
|
String |
getEventLoggingExtraInfo()
this won't be called since we don't do ICache logging here.
|
Set<K> |
getKeySet()
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> |
getRemoteCache()
This is temporary.
|
int |
getSize()
No remote invocation.
|
IStats |
getStatistics() |
String |
getStats()
Returns the statistics in String form.
|
CacheStatus |
getStatus()
Returns the asyn cache status.
|
boolean |
remove(K key)
Adds a remove request to the remote cache.
|
void |
removeAll()
Adds a removeAll request to the remote cache.
|
void |
resetEventQ()
Resets the event q by first destroying the existing one and starting up new one.
|
String |
toString()
Returns the stats and the cache.toString().
|
void |
update(ICacheElement<K,V> element)
Adds a put event to the queue.
|
createICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setElementSerializer, setKeyMatcher
public RemoteCacheNoWait(IRemoteCacheClient<K,V> cache)
cache
- public void update(ICacheElement<K,V> element) throws IOException
element
- IOException
public ICacheElement<K,V> get(K key) throws IOException
key
- IOException
public Map<K,ICacheElement<K,V>> getMatching(String pattern) throws IOException
ICache
pattern
- IOException
public Map<K,ICacheElement<K,V>> getMultiple(Set<K> keys) throws IOException
keys
- IOException
public Set<K> getKeySet() throws IOException
IOException
- if access to the auxiliary cache failsAuxiliaryCache.getKeySet()
public boolean remove(K key) throws IOException
key
- IOException
public void removeAll() throws IOException
IOException
public void dispose()
public int getSize()
public ICacheType.CacheType getCacheType()
public CacheStatus getStatus()
public String getCacheName()
public void fixCache(ICacheServiceNonLocal<?,?> remote)
remote
- public void resetEventQ()
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.
protected IRemoteCacheClient<K,V> getRemoteCache()
public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
AuxiliaryCache
protected ICacheEventQueue<K,V> getCacheEventQueue()
public String toString()
toString
in class Object
Object.toString()
public IStats getStatistics()
public String getEventLoggingExtraInfo()
getEventLoggingExtraInfo
in class AbstractAuxiliaryCache<K,V>
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.