Class LateralTCPService<K,V>
java.lang.Object
org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.LateralTCPService<K,V>
- All Implemented Interfaces:
Remote,ICacheService<K,,V> ICacheServiceNonLocal<K,V>
A lateral cache service implementation. Does not implement getGroupKey
TODO: Remove generics
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Specify serializerLateralTCPService(ITCPLateralCacheAttributes lca, IElementSerializer serializer) Constructor for the LateralTCPService object -
Method Summary
Modifier and TypeMethodDescriptionvoidWill close the connection.Returns a cache bean from the specified cache; or null if the key does not exist.If get is allowed, we will issues a get request.Return the keys in this cache.protected longMap<K,ICacheElement<K, V>> getMatching(String cacheName, String pattern) If allow get is true, we will issue a getmatching query.Map<K,ICacheElement<K, V>> getMatching(String cacheName, String pattern, long requesterId) If allow get is true, we will issue a getmatching query.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) This issues a separate get for each item.static voidDeprecated.Use unit testsvoidrelease()Does nothing.voidUses the default listener id and calls the next remove method.voidWraps the key in a LateralElementDescriptor.voidRemove all keys from the specified cache.voidRemove all keys from the specified cache.protected voidsetListenerId(long listernId) voidupdate(ICacheElement<K, V> item) Puts a cache item to the cache.voidupdate(ICacheElement<K, V> item, long requesterId) If put is allowed, we will issue a put.
-
Constructor Details
-
LateralTCPService
Deprecated.Specify serializerConstructor for the LateralTCPService object- Parameters:
lca- ITCPLateralCacheAttributes the configuration object- Throws:
IOException
-
LateralTCPService
public LateralTCPService(ITCPLateralCacheAttributes lca, IElementSerializer serializer) throws IOException Constructor for the LateralTCPService object- Parameters:
lca- ITCPLateralCacheAttributes the configuration objectserializer- the serializer to use when sending- Throws:
IOException- Since:
- 3.1
-
-
Method Details
-
update
Description copied from interface:ICacheServicePuts a cache item to the cache.- Specified by:
updatein interfaceICacheService<K,V> - Parameters:
item-- Throws:
IOException
-
update
If put is allowed, we will issue a put. If issue put on remove is configured, we will issue a remove. Either way, we create a lateral element descriptor, which is essentially a JCS TCP packet. It describes what operation the receiver should take when it gets the packet.- Specified by:
updatein interfaceICacheServiceNonLocal<K,V> - Throws:
IOException- See Also:
-
remove
Uses the default listener id and calls the next remove method.- Specified by:
removein interfaceICacheService<K,V> - Throws:
IOException- See Also:
-
remove
Wraps the key in a LateralElementDescriptor.- Specified by:
removein interfaceICacheServiceNonLocal<K,V> - Throws:
IOException- See Also:
-
release
Does nothing.- Specified by:
releasein interfaceICacheService<K,V> - Throws:
IOException
-
dispose
Will close the connection.- Specified by:
disposein interfaceICacheService<K,V> - Parameters:
cacheName-- Throws:
IOException
-
get
Description copied from interface:ICacheServiceReturns a cache bean from the specified cache; or null if the key does not exist.- Specified by:
getin interfaceICacheService<K,V> - Parameters:
cacheName-key-- Returns:
- ICacheElement<K, V> if found.
- Throws:
IOException
-
get
If get is allowed, we will issues a get request.- Specified by:
getin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-key-requesterId-- Returns:
- ICacheElement<K, V> if found.
- Throws:
IOException
-
getMatching
If allow get is true, we will issue a getmatching query.- Specified by:
getMatchingin interfaceICacheService<K,V> - Parameters:
cacheName-pattern-- Returns:
- a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache matching the pattern.
- Throws:
IOException
-
getMatching
public Map<K,ICacheElement<K, getMatchingV>> (String cacheName, String pattern, long requesterId) throws IOException If allow get is true, we will issue a getmatching query.- Specified by:
getMatchingin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-pattern-requesterId- - our identity- Returns:
- a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache matching the pattern.
- Throws:
IOException
-
getMultiple
Gets multiple items from the cache based on the given set of keys.- Specified by:
getMultiplein interfaceICacheService<K,V> - Parameters:
cacheName-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
-
getMultiple
public Map<K,ICacheElement<K, getMultipleV>> (String cacheName, Set<K> keys, long requesterId) throws IOException This issues a separate get for each item.TODO We should change this. It should issue one request.
- Specified by:
getMultiplein interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-keys-requesterId-- 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
-
getKeySet
Return the keys in this cache.- Specified by:
getKeySetin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName- the name of the cache region- 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- See Also:
-
removeAll
Description copied from interface:ICacheServiceRemove all keys from the specified cache.- Specified by:
removeAllin interfaceICacheService<K,V> - Parameters:
cacheName-- Throws:
IOException
-
removeAll
Description copied from interface:ICacheServiceNonLocalRemove all keys from the specified cache.- Specified by:
removeAllin interfaceICacheServiceNonLocal<K,V> - Parameters:
cacheName-requesterId-- Throws:
IOException
-
main
Deprecated.Use unit testsTest- Parameters:
args-
-
setListenerId
- Parameters:
listernId- The listernId to set.
-
getListenerId
- Returns:
- Returns the listernId.
-