public abstract class AbstractRemoteCacheService<K,V> extends Object implements ICacheServiceNonLocal<K,V>
Constructor and Description |
---|
AbstractRemoteCacheService(ICompositeCacheManager cacheManager,
ICacheEventLogger cacheEventLogger)
Creates the super with the needed items.
|
Modifier and Type | Method and Description |
---|---|
protected ICacheEvent<ICacheElement<K,V>> |
createICacheEvent(ICacheElement<K,V> item,
long requesterId,
String eventName)
Logs an event if an event logger is configured.
|
protected <T> ICacheEvent<T> |
createICacheEvent(String cacheName,
T key,
long requesterId,
String eventName)
Logs an event if an event logger is configured.
|
void |
dispose(String cacheName)
Frees the specified remote cache.
|
void |
dispose(String cacheName,
long requesterId)
Frees the specified remote cache.
|
ICacheElement<K,V> |
get(String cacheName,
K key)
Returns a cache value from the specified remote cache; or null if the cache or key does not
exist.
|
ICacheElement<K,V> |
get(String cacheName,
K key,
long requesterId)
Returns a cache bean from the specified cache; or null if the key does not exist.
|
protected ICompositeCacheManager |
getCacheManager() |
protected String |
getEventLogSourceName() |
protected abstract String |
getExtraInfoForRequesterId(long requesterId)
Ip address for the client, if one is stored.
|
Set<K> |
getKeySet(String cacheName)
Return the keys in this cache.
|
Map<K,ICacheElement<K,V>> |
getMatching(String cacheName,
String pattern)
Gets all matching items.
|
Map<K,ICacheElement<K,V>> |
getMatching(String cacheName,
String pattern,
long requesterId)
Retrieves all matching keys.
|
Map<K,ICacheElement<K,V>> |
getMultiple(String cacheName,
Set<K> keys)
Gets multiple items from the cache based on the given set of keys.
|
Map<K,ICacheElement<K,V>> |
getMultiple(String cacheName,
Set<K> keys,
long requesterId)
Gets multiple items from the cache based on the given set of keys.
|
String |
getStats()
Gets the stats attribute of the RemoteCacheServer object.
|
protected void |
logApplicationEvent(String source,
String eventName,
String optionalDetails)
Logs an event if an event logger is configured.
|
protected <T> void |
logICacheEvent(ICacheEvent<T> cacheEvent)
Logs an event if an event logger is configured.
|
Set<K> |
processGetKeySet(String cacheName)
Gets the set of keys of objects currently in the cache.
|
void |
remove(String cacheName,
K key)
Removes the given key from the specified remote cache.
|
void |
remove(String cacheName,
K key,
long requesterId)
Remove the key from the cache region and don't tell the source listener about it.
|
void |
removeAll(String cacheName)
Remove all keys from the specified remote cache.
|
void |
removeAll(String cacheName,
long requesterId)
Remove all keys from the specified remote cache.
|
void |
setCacheEventLogger(ICacheEventLogger cacheEventLogger)
Allows it to be injected.
|
protected void |
setCacheManager(ICompositeCacheManager cacheManager) |
protected void |
setEventLogSourceName(String eventLogSourceName) |
void |
update(ICacheElement<K,V> item)
Puts a cache item to the cache.
|
void |
update(ICacheElement<K,V> item,
long requesterId)
The internal processing is wrapped in event logging calls.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
release
public AbstractRemoteCacheService(ICompositeCacheManager cacheManager, ICacheEventLogger cacheEventLogger)
cacheManager
- cacheEventLogger
- public void update(ICacheElement<K,V> item) throws IOException
ICacheService
update
in interface ICacheService<K,V>
item
- IOException
public void update(ICacheElement<K,V> item, long requesterId) throws IOException
update
in interface ICacheServiceNonLocal<K,V>
item
- requesterId
- IOException
public ICacheElement<K,V> get(String cacheName, K key) throws IOException
get
in interface ICacheService<K,V>
cacheName
- key
- IOException
public ICacheElement<K,V> get(String cacheName, K key, long requesterId) throws IOException
Adding the requestor id, allows the cache to determine the source of the get.
The internal processing is wrapped in event logging calls.
get
in interface ICacheServiceNonLocal<K,V>
cacheName
- key
- requesterId
- IOException
public Map<K,ICacheElement<K,V>> getMatching(String cacheName, String pattern) throws IOException
getMatching
in interface ICacheService<K,V>
cacheName
- pattern
- IOException
public Map<K,ICacheElement<K,V>> getMatching(String cacheName, String pattern, long requesterId) throws IOException
getMatching
in interface ICacheServiceNonLocal<K,V>
cacheName
- pattern
- requesterId
- IOException
public Map<K,ICacheElement<K,V>> getMultiple(String cacheName, Set<K> keys) throws IOException
getMultiple
in interface ICacheService<K,V>
cacheName
- keys
- IOException
public Map<K,ICacheElement<K,V>> getMultiple(String cacheName, Set<K> keys, long requesterId) throws IOException
The internal processing is wrapped in event logging calls.
getMultiple
in interface ICacheServiceNonLocal<K,V>
cacheName
- keys
- requesterId
- IOException
public Set<K> getKeySet(String cacheName)
getKeySet
in interface ICacheServiceNonLocal<K,V>
cacheName
- the name of the cacheAuxiliaryCache.getKeySet()
public Set<K> processGetKeySet(String cacheName)
cacheName
- public void remove(String cacheName, K key) throws IOException
remove
in interface ICacheService<K,V>
cacheName
- key
- IOException
public void remove(String cacheName, K key, long requesterId) throws IOException
The internal processing is wrapped in event logging calls.
remove
in interface ICacheServiceNonLocal<K,V>
cacheName
- key
- requesterId
- IOException
public void removeAll(String cacheName) throws IOException
removeAll
in interface ICacheService<K,V>
cacheName
- IOException
public void removeAll(String cacheName, long requesterId) throws IOException
The internal processing is wrapped in event logging calls.
removeAll
in interface ICacheServiceNonLocal<K,V>
cacheName
- requesterId
- IOException
public void dispose(String cacheName) throws IOException
dispose
in interface ICacheService<K,V>
cacheName
- IOException
public void dispose(String cacheName, long requesterId) throws IOException
cacheName
- requesterId
- IOException
public String getStats() throws IOException
IOException
protected ICacheEvent<ICacheElement<K,V>> createICacheEvent(ICacheElement<K,V> item, long requesterId, String eventName)
item
- requesterId
- eventName
- protected <T> ICacheEvent<T> createICacheEvent(String cacheName, T key, long requesterId, String eventName)
cacheName
- key
- requesterId
- eventName
- protected void logApplicationEvent(String source, String eventName, String optionalDetails)
source
- eventName
- optionalDetails
- protected <T> void logICacheEvent(ICacheEvent<T> cacheEvent)
cacheEvent
- protected abstract String getExtraInfoForRequesterId(long requesterId)
Protected for testing.
requesterId
- public void setCacheEventLogger(ICacheEventLogger cacheEventLogger)
cacheEventLogger
- protected void setCacheManager(ICompositeCacheManager cacheManager)
cacheManager
- the cacheManager to setprotected ICompositeCacheManager getCacheManager()
protected void setEventLogSourceName(String eventLogSourceName)
eventLogSourceName
- the eventLogSourceName to setprotected String getEventLogSourceName()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.