org.infinispan.client.hotrod.impl
Class RemoteCacheSupport<K,V>

java.lang.Object
  extended by org.infinispan.CacheSupport<K,V>
      extended by org.infinispan.client.hotrod.impl.RemoteCacheSupport<K,V>
All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>, BasicCache<K,V>, RemoteCache<K,V>, Lifecycle
Direct Known Subclasses:
RemoteCacheImpl

public abstract class RemoteCacheSupport<K,V>
extends CacheSupport<K,V>
implements RemoteCache<K,V>

Purpose: keep all delegating and unsupported methods in one place -> readability.

Since:
4.1
Author:
Mircea.Markus@jboss.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.infinispan.CacheSupport
defaultLifespan, defaultMaxIdleTime
 
Constructor Summary
RemoteCacheSupport()
           
 
Method Summary
 boolean containsValue(Object value)
           
 Set<Map.Entry<K,V>> entrySet()
           
 Set<K> keySet()
           
 boolean remove(Object key, Object value)
          This operation is not supported.
 NotifyingFuture<Boolean> removeAsync(Object key, Object value)
          This operation is not supported.
 boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
          This operation is not supported.
 NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
          This operation is not supported.
 boolean replaceWithVersion(K key, V newValue, long version)
          Replaces the given value only if its version matches the supplied version.
 boolean replaceWithVersion(K key, V newValue, long version, int lifespanSeconds)
          A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan parameters.
 NotifyingFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version)
           
 NotifyingFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds)
           
 Collection<V> values()
           
 
Methods inherited from class org.infinispan.CacheSupport
put, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putAsync, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.infinispan.client.hotrod.RemoteCache
getBulk, getBulk, getRemoteCacheManager, getVersioned, isEmpty, putAll, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, removeWithVersion, removeWithVersionAsync, replace, replace, replaceAsync, replaceAsync, replaceWithVersion, replaceWithVersionAsync, size, stats, withFlags
 
Methods inherited from interface org.infinispan.api.BasicCache
clearAsync, getAsync, getName, getVersion, put, put, putAsync, putAsync, putAsync, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, replace, replace, replaceAsync, replaceAsync, replaceAsync
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
putIfAbsent, replace
 
Methods inherited from interface java.util.Map
clear, containsKey, equals, get, hashCode, put, remove
 
Methods inherited from interface org.infinispan.lifecycle.Lifecycle
start, stop
 

Constructor Detail

RemoteCacheSupport

public RemoteCacheSupport()
Method Detail

replaceWithVersionAsync

public NotifyingFuture<Boolean> replaceWithVersionAsync(K key,
                                                        V newValue,
                                                        long version)
Specified by:
replaceWithVersionAsync in interface RemoteCache<K,V>
See Also:
RemoteCache.replaceWithVersion(Object, Object, long)

replaceWithVersionAsync

public NotifyingFuture<Boolean> replaceWithVersionAsync(K key,
                                                        V newValue,
                                                        long version,
                                                        int lifespanSeconds)
Specified by:
replaceWithVersionAsync in interface RemoteCache<K,V>
See Also:
RemoteCache.replaceWithVersion(Object, Object, long)

replaceWithVersion

public boolean replaceWithVersion(K key,
                                  V newValue,
                                  long version)
Description copied from interface: RemoteCache
Replaces the given value only if its version matches the supplied version. See RemoteCache.removeWithVersion(Object, long) for a sample usage of the version-based methods.

Specified by:
replaceWithVersion in interface RemoteCache<K,V>
version - numeric version that should match the one in the server for the operation to succeed
Returns:
true if the value has been replaced
See Also:
RemoteCache.getVersioned(Object), VersionedValue

replaceWithVersion

public boolean replaceWithVersion(K key,
                                  V newValue,
                                  long version,
                                  int lifespanSeconds)
Description copied from interface: RemoteCache
A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan parameters.

Specified by:
replaceWithVersion in interface RemoteCache<K,V>
Parameters:
key - key to use
newValue - new value to be associated with the key
version - numeric version that should match the one in the server for the operation to succeed
lifespanSeconds - lifespan of the entry
Returns:
true if the value was replaced

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<K,V>
Specified by:
containsValue in interface RemoteCache<K,V>

keySet

public Set<K> keySet()
Specified by:
keySet in interface Map<K,V>
Specified by:
keySet in interface RemoteCache<K,V>

values

public Collection<V> values()
Specified by:
values in interface Map<K,V>
Specified by:
values in interface RemoteCache<K,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>
Specified by:
entrySet in interface RemoteCache<K,V>

remove

public boolean remove(Object key,
                      Object value)
Description copied from interface: RemoteCache
This operation is not supported. Consider using RemoteCache.removeWithVersion(Object, long) instead.

Specified by:
remove in interface ConcurrentMap<K,V>
Specified by:
remove in interface RemoteCache<K,V>

removeAsync

public NotifyingFuture<Boolean> removeAsync(Object key,
                                            Object value)
Description copied from interface: RemoteCache
This operation is not supported. Consider using RemoteCache.removeWithVersionAsync(Object, long) instead.

Specified by:
removeAsync in interface BasicCache<K,V>
Specified by:
removeAsync in interface RemoteCache<K,V>
Parameters:
key - key to remove
value - value to match on
Returns:
a future containing a boolean, indicating whether the entry was removed or not

replace

public boolean replace(K key,
                       V oldValue,
                       V value,
                       long lifespan,
                       TimeUnit lifespanUnit,
                       long maxIdleTime,
                       TimeUnit maxIdleTimeUnit)
Description copied from interface: RemoteCache
This operation is not supported. Consider using RemoteCache.replaceWithVersion(Object, Object, long, int, int) instead.

Specified by:
replace in interface BasicCache<K,V>
Specified by:
replace in interface RemoteCache<K,V>
Parameters:
key - key to use
oldValue - value to replace
value - value to store
lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
lifespanUnit - time unit for lifespan
maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
maxIdleTimeUnit - time unit for max idle time
Returns:
true if the value was replaced, false otherwise

replaceAsync

public NotifyingFuture<Boolean> replaceAsync(K key,
                                             V oldValue,
                                             V newValue,
                                             long lifespan,
                                             TimeUnit lifespanUnit,
                                             long maxIdle,
                                             TimeUnit maxIdleUnit)
Description copied from interface: RemoteCache
This operation is not supported. Consider using RemoteCache.replaceWithVersion(Object, Object, long, int, int) instead.

Specified by:
replaceAsync in interface BasicCache<K,V>
Specified by:
replaceAsync in interface RemoteCache<K,V>
Parameters:
key - key to remove
oldValue - value to overwrite
newValue - value to store
lifespan - lifespan of entry
lifespanUnit - time unit for lifespan
maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
maxIdleUnit - time unit for max idle time
Returns:
a future containing a boolean, indicating whether the entry was replaced or not

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.