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 SummaryConstructorsConstructorDescriptionDeprecated.Specify serializerLateralTCPService(ITCPLateralCacheAttributes lca, IElementSerializer serializer) Constructor for the LateralTCPService object
- 
Method SummaryModifier 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- 
LateralTCPServiceDeprecated.Specify serializerConstructor for the LateralTCPService object- Parameters:
- lca- ITCPLateralCacheAttributes the configuration object
- Throws:
- IOException
 
- 
LateralTCPServicepublic LateralTCPService(ITCPLateralCacheAttributes lca, IElementSerializer serializer) throws IOException Constructor for the LateralTCPService object- Parameters:
- lca- ITCPLateralCacheAttributes the configuration object
- serializer- the serializer to use when sending
- Throws:
- IOException
- Since:
- 3.1
 
 
- 
- 
Method Details- 
updateDescription copied from interface:ICacheServicePuts a cache item to the cache.- Specified by:
- updatein interface- ICacheService<K,- V> 
- Parameters:
- item-
- Throws:
- IOException
 
- 
updateIf 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 interface- ICacheServiceNonLocal<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
removeUses the default listener id and calls the next remove method.- Specified by:
- removein interface- ICacheService<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
removeWraps the key in a LateralElementDescriptor.- Specified by:
- removein interface- ICacheServiceNonLocal<K,- V> 
- Throws:
- IOException
- See Also:
 
- 
releaseDoes nothing.- Specified by:
- releasein interface- ICacheService<K,- V> 
- Throws:
- IOException
 
- 
disposeWill close the connection.- Specified by:
- disposein interface- ICacheService<K,- V> 
- Parameters:
- cacheName-
- Throws:
- IOException
 
- 
getDescription copied from interface:ICacheServiceReturns a cache bean from the specified cache; or null if the key does not exist.- Specified by:
- getin interface- ICacheService<K,- V> 
- Parameters:
- cacheName-
- key-
- Returns:
- ICacheElement<K, V> if found.
- Throws:
- IOException
 
- 
getIf get is allowed, we will issues a get request.- Specified by:
- getin interface- ICacheServiceNonLocal<K,- V> 
- Parameters:
- cacheName-
- key-
- requesterId-
- Returns:
- ICacheElement<K, V> if found.
- Throws:
- IOException
 
- 
getMatchingIf allow get is true, we will issue a getmatching query.- Specified by:
- getMatchingin interface- ICacheService<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
 
- 
getMatchingpublic 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 interface- ICacheServiceNonLocal<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
 
- 
getMultipleGets multiple items from the cache based on the given set of keys.- Specified by:
- getMultiplein interface- ICacheService<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
 
- 
getMultiplepublic 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 interface- ICacheServiceNonLocal<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
 
- 
getKeySetReturn the keys in this cache.- Specified by:
- getKeySetin interface- ICacheServiceNonLocal<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:
 
- 
removeAllDescription copied from interface:ICacheServiceRemove all keys from the specified cache.- Specified by:
- removeAllin interface- ICacheService<K,- V> 
- Parameters:
- cacheName-
- Throws:
- IOException
 
- 
removeAllDescription copied from interface:ICacheServiceNonLocalRemove all keys from the specified cache.- Specified by:
- removeAllin interface- ICacheServiceNonLocal<K,- V> 
- Parameters:
- cacheName-
- requesterId-
- Throws:
- IOException
 
- 
mainDeprecated.Use unit testsTest- Parameters:
- args-
 
- 
setListenerId- Parameters:
- listernId- The listernId to set.
 
- 
getListenerId- Returns:
- Returns the listernId.
 
 
-