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>, Cache<K,V>, RemoteCache<K,V>, Lifecycle, Listenable
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
 void addListener(Object listener)
          Operation might be supported for smart clients that will be able to register for topology changes.
 void compact()
          This operation is not supported.
 boolean containsValue(Object value)
           
 void endBatch(boolean successful)
          Completes a batch if one has been started using Cache.startBatch().
 Set<Map.Entry<K,V>> entrySet()
          Returns a set view of the mappings contained in this cache.
 void evict(K key)
          Evicts an entry from the memory of the cache.
 AdvancedCache<K,V> getAdvancedCache()
          This operation is not supported.
 CacheContainer getCacheManager()
          Retrieves the cache manager responsible for creating this cache instance.
 Configuration getConfiguration()
           
 Set<Object> getListeners()
           
 ComponentStatus getStatus()
           
 boolean isEmpty()
           
 Set<K> keySet()
          Returns a set view of the keys contained in this cache.
 void putForExternalRead(K key, V value)
          This operation is not supported.
 boolean remove(Object key, Object value)
          This operation is not supported.
 NotifyingFuture<Boolean> removeAsync(Object key, Object value)
          This operation is not supported.
 void removeListener(Object listener)
          Removes a listener from the component.
 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)
          Removes the given value only if its version matches the supplied version.
 boolean replaceWithVersion(K key, V newValue, long version, int lifespanSeconds)
           
 NotifyingFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version)
           
 NotifyingFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds)
           
 int size()
           
 boolean startBatch()
          Starts a batch.
 Collection<V> values()
          Returns a collection view of the values contained in this cache.
 
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
 
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, putAll, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, removeWithVersion, removeWithVersionAsync, replace, replace, replaceAsync, replaceAsync, replaceWithVersion, replaceWithVersionAsync, stats, withFlags
 
Methods inherited from interface org.infinispan.Cache
clearAsync, 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
Removes the given value only if its version matches the supplied version. See RemoteCache.removeWithVersion(Object, long) for a sample usage.

Specified by:
replaceWithVersion in interface RemoteCache<K,V>
Returns:
true if the method has been replaced
See Also:
RemoteCache.getVersioned(Object), VersionedValue

getCacheManager

public CacheContainer getCacheManager()
Description copied from interface: Cache
Retrieves the cache manager responsible for creating this cache instance.

Specified by:
getCacheManager in interface Cache<K,V>
Returns:
a cache manager

replaceWithVersion

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

putForExternalRead

public void putForExternalRead(K key,
                               V value)
Description copied from interface: RemoteCache
This operation is not supported.

Specified by:
putForExternalRead in interface Cache<K,V>
Specified by:
putForExternalRead in interface RemoteCache<K,V>
Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.

addListener

public void addListener(Object listener)
Description copied from interface: RemoteCache
Operation might be supported for smart clients that will be able to register for topology changes.

Specified by:
addListener in interface RemoteCache<K,V>
Specified by:
addListener in interface Listenable
Parameters:
listener - must not be null.

removeListener

public void removeListener(Object listener)
Description copied from interface: Listenable
Removes a listener from the component.

Specified by:
removeListener in interface RemoteCache<K,V>
Specified by:
removeListener in interface Listenable
Parameters:
listener - listener to remove. Must not be null.
See Also:
RemoteCache.addListener(Object)

getListeners

public Set<Object> getListeners()
Specified by:
getListeners in interface RemoteCache<K,V>
Specified by:
getListeners in interface Listenable
Returns:
a set of all listeners registered on this component.
See Also:
RemoteCache.addListener(Object)

size

public int size()
Specified by:
size in interface Map<K,V>
Specified by:
size in interface RemoteCache<K,V>

isEmpty

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

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()
Description copied from interface: Cache
Returns a set view of the keys contained in this cache. This set is immutable, so it cannot be modified and changes to the cache won't be reflected in the set. When this method is called on a cache configured with distribution mode, the set returned only contains the keys locally available in the cache instance. To avoid memory issues, there will be not attempt to bring keys from other nodes.

This method should only be used for debugging purposes such as to verify that the cache contains all the keys entered. Any other use involving execution of this method on a production system is not recommended.

Specified by:
keySet in interface Map<K,V>
Specified by:
keySet in interface Cache<K,V>
Specified by:
keySet in interface RemoteCache<K,V>
Returns:
a set view of the keys contained in this cache.

values

public Collection<V> values()
Description copied from interface: Cache
Returns a collection view of the values contained in this cache. This collection is immutable, so it cannot be modified and changes to the cache won't be reflected in the set. When this method is called on a cache configured with distribution mode, the collection returned only contains the values locally available in the cache instance. To avoid memory issues, there is not attempt to bring values from other nodes.

This method should only be used for testing or debugging purposes such as to verify that the cache contains all the values entered. Any other use involving execution of this method on a production system is not recommended.

Specified by:
values in interface Map<K,V>
Specified by:
values in interface Cache<K,V>
Specified by:
values in interface RemoteCache<K,V>
Returns:
a collection view of the values contained in this map.

entrySet

public Set<Map.Entry<K,V>> entrySet()
Description copied from interface: Cache
Returns a set view of the mappings contained in this cache. This set is immutable, so it cannot be modified and changes to the cache won't be reflected in the set. Besides, each element in the returned set is an immutable Map.Entry. When this method is called on a cache configured with distribution mode, the set returned only contains the mappings locally available in the cache instance. To avoid memory issues, there will be not attempt to bring mappings from other nodes.

This method should only be used for debugging purposes such as to verify that the cache contains all the mappings entered. Any other use involving execution of this method on a production system is not recommended.

Specified by:
entrySet in interface Map<K,V>
Specified by:
entrySet in interface Cache<K,V>
Specified by:
entrySet in interface RemoteCache<K,V>
Returns:
a set view of the mappings contained in this cache.

evict

public void evict(K key)
Description copied from interface: Cache
Evicts an entry from the memory of the cache. Note that the entry is not removed from any configured cache stores or any other caches in the cluster (if used in a clustered mode). Use Map.remove(Object) to remove an entry from the entire cache system.

This method is designed to evict an entry from memory to free up memory used by the application. This method uses a 0 lock acquisition timeout so it does not block in attempting to acquire locks. It behaves as a no-op if the lock on the entry cannot be acquired immediately.

Important: this method should not be called from within a transaction scope.

Specified by:
evict in interface Cache<K,V>
Specified by:
evict in interface RemoteCache<K,V>
Parameters:
key - key to evict

getConfiguration

public Configuration getConfiguration()
Specified by:
getConfiguration in interface Cache<K,V>
Specified by:
getConfiguration in interface RemoteCache<K,V>

startBatch

public boolean startBatch()
Description copied from interface: Cache
Starts a batch. All operations on the current client thread are performed as a part of this batch, with locks held for the duration of the batch and any remote calls delayed till the end of the batch.

Specified by:
startBatch in interface Cache<K,V>
Specified by:
startBatch in interface RemoteCache<K,V>
Returns:
true if a batch was successfully started; false if one was available and already running.

endBatch

public void endBatch(boolean successful)
Description copied from interface: Cache
Completes a batch if one has been started using Cache.startBatch(). If no batch has been started, this is a no-op.

Specified by:
endBatch in interface Cache<K,V>
Specified by:
endBatch in interface RemoteCache<K,V>
Parameters:
successful - if true, the batch completes, otherwise the batch is aborted and changes are not committed.

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 Cache<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 Cache<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 Cache<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

getAdvancedCache

public AdvancedCache<K,V> getAdvancedCache()
Description copied from interface: RemoteCache
This operation is not supported.

Specified by:
getAdvancedCache in interface Cache<K,V>
Specified by:
getAdvancedCache in interface RemoteCache<K,V>

compact

public void compact()
Description copied from interface: RemoteCache
This operation is not supported.

Specified by:
compact in interface Cache<K,V>
Specified by:
compact in interface RemoteCache<K,V>

getStatus

public ComponentStatus getStatus()
Specified by:
getStatus in interface Cache<K,V>

Google Analytics

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