Class RemoteCacheSupport<K,V>
- java.lang.Object
-
- org.infinispan.client.hotrod.impl.RemoteCacheSupport<K,V>
-
- All Implemented Interfaces:
ConcurrentMap<K,V>
,Map<K,V>
,RemoteCache<K,V>
,org.infinispan.commons.api.AsyncCache<K,V>
,org.infinispan.commons.api.BasicCache<K,V>
,org.infinispan.commons.api.Lifecycle
,org.infinispan.commons.api.TransactionalCache
- Direct Known Subclasses:
RemoteCacheImpl
public abstract class RemoteCacheSupport<K,V> extends Object implements RemoteCache<K,V>
Purpose: keep all delegating and unsupported methods in one place -> readability.- Since:
- 4.1
- Author:
- Mircea.Markus@jboss.com
-
-
Field Summary
Fields Modifier and Type Field Description protected long
defaultLifespan
protected long
defaultMaxIdleTime
-
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteCacheSupport()
protected
RemoteCacheSupport(long defaultLifespan, long defaultMaxIdleTime)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description V
merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
V
merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
V
merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
V
put(K key, V value)
V
put(K key, V value, long lifespan, TimeUnit unit)
void
putAll(Map<? extends K,? extends V> map)
Synthetic operation.void
putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
Synthetic operation.CompletableFuture<Void>
putAllAsync(Map<? extends K,? extends V> data)
Synthetic operation.CompletableFuture<Void>
putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit unit)
Synthetic operation.CompletableFuture<V>
putAsync(K key, V value)
CompletableFuture<V>
putAsync(K key, V value, long lifespan, TimeUnit unit)
V
putIfAbsent(K key, V value)
V
putIfAbsent(K key, V value, long lifespan, TimeUnit unit)
CompletableFuture<V>
putIfAbsentAsync(K key, V value)
CompletableFuture<V>
putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit)
CompletableFuture<Boolean>
removeAsync(Object key, Object value)
V
replace(K key, V value)
V
replace(K key, V value, long lifespan, TimeUnit unit)
boolean
replace(K key, V oldValue, V newValue)
boolean
replace(K key, V oldValue, V value, long lifespan, TimeUnit unit)
CompletableFuture<V>
replaceAsync(K key, V value)
CompletableFuture<V>
replaceAsync(K key, V value, long lifespan, TimeUnit unit)
CompletableFuture<Boolean>
replaceAsync(K key, V oldValue, V newValue)
CompletableFuture<Boolean>
replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit)
CompletableFuture<Boolean>
replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
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 ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan parameters.CompletableFuture<Boolean>
replaceWithVersionAsync(K key, V newValue, long version)
CompletableFuture<Boolean>
replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds)
protected abstract void
set(K key, V value)
This is intentionally a non-public method meant as an integration point for bytecode manipulation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.commons.api.AsyncCache
clearAsync, containsKeyAsync, getAllAsync, getAsync, putAsync, putIfAbsentAsync, removeAsync, replaceAsync
-
Methods inherited from interface org.infinispan.commons.api.BasicCache
getName, getVersion, put, putIfAbsent, replace
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, replaceAll
-
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, size
-
Methods inherited from interface org.infinispan.client.hotrod.RemoteCache
addClientListener, addClientListener, entrySet, execute, execute, getAll, getBulk, getBulk, getCacheTopologyInfo, getDataFormat, getListeners, getProtocolVersion, getRemoteCacheManager, getVersioned, getWithMetadata, keySet, putAll, putAllAsync, remove, remove, removeClientListener, removeWithVersion, removeWithVersionAsync, replace, replaceWithVersion, replaceWithVersion, replaceWithVersionAsync, retrieveEntries, retrieveEntries, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, stats, streaming, values, withDataFormat, withFlags
-
-
-
-
Method Detail
-
putAll
public void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
Description copied from interface:RemoteCache
Synthetic operation. The client iterates over the set of keys and calls put for each one of them. This results in operation not being atomic (if a failure happens after few puts it is not rolled back) and costly (for each key in the parameter map a remote call is performed).
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data)
Description copied from interface:RemoteCache
Synthetic operation.- Specified by:
putAllAsync
in interfaceorg.infinispan.commons.api.AsyncCache<K,V>
- Specified by:
putAllAsync
in interfaceRemoteCache<K,V>
- See Also:
RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit unit)
Description copied from interface:RemoteCache
Synthetic operation.- Specified by:
putAllAsync
in interfaceorg.infinispan.commons.api.AsyncCache<K,V>
- Specified by:
putAllAsync
in interfaceRemoteCache<K,V>
- See Also:
RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
-
putAll
public void putAll(Map<? extends K,? extends V> map)
Description copied from interface:RemoteCache
Synthetic operation.- Specified by:
putAll
in interfaceMap<K,V>
- Specified by:
putAll
in interfaceRemoteCache<K,V>
- See Also:
RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
-
putIfAbsent
public V putIfAbsent(K key, V value)
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,V>
- Specified by:
putIfAbsent
in interfaceMap<K,V>
-
replace
public boolean replace(K key, V oldValue, V newValue)
Description copied from interface:RemoteCache
This method requires 2 round trips to the server. The first to retrieve the value and version and a second to replace the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.replaceWithVersion(Object, Object, long)
.
-
set
protected abstract void set(K key, V value)
This is intentionally a non-public method meant as an integration point for bytecode manipulation. Don't remove or alter the signature even if it might look like unreachable code. Implementors should perform a put operation but optimizing it as return values are not required.- Since:
- 5.0
-
putAsync
public final CompletableFuture<V> putAsync(K key, V value)
-
putAsync
public CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit unit)
-
replaceWithVersionAsync
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version)
- Specified by:
replaceWithVersionAsync
in interfaceRemoteCache<K,V>
- See Also:
RemoteCache.replaceWithVersion(Object, Object, long)
-
replaceWithVersionAsync
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds)
- Specified by:
replaceWithVersionAsync
in interfaceRemoteCache<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. SeeRemoteCache.removeWithVersion(Object, long)
for a sample usage of the version-based methods.- Specified by:
replaceWithVersion
in interfaceRemoteCache<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 ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan parameters.- Specified by:
replaceWithVersion
in interfaceRemoteCache<K,V>
- Parameters:
key
- key to usenewValue
- new value to be associated with the keyversion
- numeric version that should match the one in the server for the operation to succeedlifespanSeconds
- lifespan of the entry- Returns:
- true if the value was replaced
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value)
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value)
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit)
-
removeAsync
public CompletableFuture<Boolean> removeAsync(Object key, Object value)
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit)
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit)
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
-
replace
public boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit)
Description copied from interface:RemoteCache
This method requires 2 round trips to the server. The first to retrieve the value and version and a second to replace the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.replaceWithVersion(Object, Object, long, long, TimeUnit, long, TimeUnit)
.
-
merge
public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
-
merge
public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
-
-