public class TransactionalRemoteCacheImpl<K,V> extends RemoteCacheImpl<K,V>
RemoteCache
implementation that handles Transaction
.
All streaming operation (example RemoteCache.retrieveEntries(String, int)
) and RemoteCacheSupport.size()
aren't transactional in a way they don't interact with the transaction's data
(keys, values).
containsValue(Object)
is a special case where a key with the specific value is
marked as read for the transaction.
clientStatistics, operationsFactory
defaultLifespan, defaultMaxIdleTime
Constructor and Description |
---|
TransactionalRemoteCacheImpl(RemoteCacheManager rcm,
String name,
boolean forceReturnValue,
boolean recoveryEnabled,
TransactionManager transactionManager,
TransactionTable transactionTable,
TimeService timeService) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Boolean> |
containsKeyAsync(K key)
Asynchronous version of
Map.containsKey(Object) |
boolean |
containsValue(Object value) |
CompletableFuture<V> |
getAsync(Object key)
Asynchronous version of
Map.get(Object) that allows user code to
retrieve the value associated with a key at a later stage, hence allowing
multiple parallel get requests to be sent. |
TransactionManager |
getTransactionManager() |
CompletableFuture<MetadataValue<V>> |
getWithMetadataAsync(K key)
Asynchronously returns the
MetadataValue associated to the supplied key param, or null if it doesn't exist. |
boolean |
isTransactional() |
CompletableFuture<Void> |
putAllAsync(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Adds or overrides each specified entry in the remote cache.
|
CompletableFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Asynchronous version of
BasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit) . |
CompletableFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Asynchronous version of
BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit) . |
CompletableFuture<V> |
removeAsync(Object key)
Asynchronous version of
BasicCache.remove(Object) . |
CompletableFuture<Boolean> |
removeAsync(Object key,
Object value)
Asynchronous version of
ConcurrentMap.remove(Object, Object) . |
CompletableFuture<Boolean> |
removeWithVersionAsync(K key,
long version) |
CompletableFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Asynchronous version of
BasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit) . |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Asynchronous version of
BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit) . |
CompletableFuture<Boolean> |
replaceWithVersionAsync(K key,
V newValue,
long version,
long lifespan,
TimeUnit lifespanTimeUnit,
long maxIdle,
TimeUnit maxIdleTimeUnit) |
addClientListener, addClientListener, assertRemoteCacheManagerIsStarted, clearAsync, clientStatistics, computeAsync, computeIfAbsentAsync, computeIfPresentAsync, entryIterator, entrySet, execute, execute, getAllAsync, getCacheTopologyInfo, getDataFormat, getListeners, getName, getOperationsFactory, getProtocolVersion, getRemoteCacheManager, getVersion, hasForceReturnFlag, init, init, isEmpty, isObjectStorage, keyAsObjectIfNeeded, keyIterator, keySet, keyToBytes, mergeAsync, ping, publishEntries, publishEntriesByQuery, publishEntriesWithMetadata, removeClientListener, replaceAll, resolveStorage, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, serverStatistics, sizeAsync, start, stop, streaming, values, valueToBytes, withDataFormat, withFlags
clear, compute, compute, compute, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresent, computeIfPresent, computeIfPresentAsync, computeIfPresentAsync, containsKey, get, getAll, getWithMetadata, merge, merge, merge, mergeAsync, mergeAsync, put, put, put, putAll, putAll, putAll, putAllAsync, putAllAsync, putAsync, putAsync, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, remove, remove, removeWithVersion, replace, replace, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceWithVersion, replaceWithVersion, replaceWithVersion, replaceWithVersion, replaceWithVersionAsync, replaceWithVersionAsync, replaceWithVersionAsync, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
removeEntry, removeEntry
entrySet, getAll, getWithMetadata, keySet, putAll, putAll, putAll, putAllAsync, putAllAsync, remove, remove, removeWithVersion, replace, replace, replace, replaceWithVersion, replaceWithVersion, replaceWithVersion, replaceWithVersion, replaceWithVersionAsync, replaceWithVersionAsync, replaceWithVersionAsync, retrieveEntries, retrieveEntries, stats, values
compute, compute, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, merge, merge, put, put, put, putIfAbsent, putIfAbsent, replace, replace
computeAsync, computeAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresentAsync, computeIfPresentAsync, mergeAsync, mergeAsync, putAsync, putAsync, putIfAbsentAsync, putIfAbsentAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, replace
public TransactionalRemoteCacheImpl(RemoteCacheManager rcm, String name, boolean forceReturnValue, boolean recoveryEnabled, TransactionManager transactionManager, TransactionTable transactionTable, TimeService timeService)
public CompletableFuture<Boolean> removeWithVersionAsync(K key, long version)
removeWithVersionAsync
in interface RemoteCache<K,V>
removeWithVersionAsync
in class RemoteCacheImpl<K,V>
RemoteCache.remove(Object, Object)
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit)
replaceWithVersionAsync
in interface RemoteCache<K,V>
replaceWithVersionAsync
in class RemoteCacheImpl<K,V>
RemoteCache.replaceWithVersion(Object, Object, long)
public CompletableFuture<MetadataValue<V>> getWithMetadataAsync(K key)
RemoteCache
MetadataValue
associated to the supplied key param, or null if it doesn't exist.getWithMetadataAsync
in interface RemoteCache<K,V>
getWithMetadataAsync
in class RemoteCacheImpl<K,V>
public CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
RemoteCache
putAllAsync
in interface RemoteCache<K,V>
putAllAsync
in interface AsyncCache<K,V>
putAllAsync
in class RemoteCacheImpl<K,V>
map
- to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timeRemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
public CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
AsyncCache
BasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block
on remote calls, even if your cache mode is synchronous.putAsync
in interface AsyncCache<K,V>
putAsync
in class RemoteCacheImpl<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
AsyncCache
BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does
not block on remote calls, even if your cache mode is synchronous.putIfAbsentAsync
in interface AsyncCache<K,V>
putIfAbsentAsync
in class RemoteCacheImpl<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
AsyncCache
BasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not
block on remote calls, even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
replaceAsync
in class RemoteCacheImpl<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
AsyncCache
BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
. This method
does not block on remote calls, even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
replaceAsync
in class RemoteCacheImpl<K,V>
key
- key to removeoldValue
- value to overwritevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic CompletableFuture<Boolean> containsKeyAsync(K key)
AsyncCache
Map.containsKey(Object)
containsKeyAsync
in interface AsyncCache<K,V>
containsKeyAsync
in class RemoteCacheImpl<K,V>
key
- key to retrievepublic boolean containsValue(Object value)
containsValue
in interface Map<K,V>
containsValue
in class RemoteCacheImpl<K,V>
public CompletableFuture<V> getAsync(Object key)
AsyncCache
Map.get(Object)
that allows user code to
retrieve the value associated with a key at a later stage, hence allowing
multiple parallel get requests to be sent. Normally, when this method
detects that the value is likely to be retrieved from from a remote
entity, it will span a different thread in order to allow the
asynchronous get call to return immediately. If the call will definitely
resolve locally, for example when the cache is configured with LOCAL mode
and no stores are configured, the get asynchronous call will act
sequentially and will have no different to Map.get(Object)
.getAsync
in interface AsyncCache<K,V>
getAsync
in class RemoteCacheImpl<K,V>
key
- key to retrieveMap.get(Object)
public CompletableFuture<V> removeAsync(Object key)
AsyncCache
BasicCache.remove(Object)
. This method does not block on remote calls, even if your cache
mode is synchronous.removeAsync
in interface AsyncCache<K,V>
removeAsync
in class RemoteCacheImpl<K,V>
key
- key to removepublic CompletableFuture<Boolean> removeAsync(Object key, Object value)
AsyncCache
ConcurrentMap.remove(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous.removeAsync
in interface AsyncCache<K,V>
removeAsync
in class RemoteCacheImpl<K,V>
key
- key to removevalue
- value to match onpublic TransactionManager getTransactionManager()
TransactionManager
in use by this cache or null
if the cache isn't transactional.public boolean isTransactional()
isTransactional
in interface RemoteCache<K,V>
isTransactional
in class RemoteCacheImpl<K,V>
true
if the cache can participate in a transaction, false
otherwise.Copyright © 2021 JBoss by Red Hat. All rights reserved.