Class TransactionalRemoteCacheImpl<K,V>
java.lang.Object
org.infinispan.client.hotrod.impl.RemoteCacheSupport<K,V>
org.infinispan.client.hotrod.impl.RemoteCacheImpl<K,V>
org.infinispan.client.hotrod.impl.transaction.TransactionalRemoteCacheImpl<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,,V> InternalRemoteCache<K,,V> RemoteCache<K,,V> AsyncCache<K,,V> BasicCache<K,,V> Lifecycle,TransactionalCache
A
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.
- Since:
- 9.3
- Author:
- Pedro Ruivo
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.infinispan.client.hotrod.impl.RemoteCacheImpl
clientStatistics, operationsFactoryFields inherited from class org.infinispan.client.hotrod.impl.RemoteCacheSupport
defaultLifespan, defaultMaxIdleTime -
Constructor Summary
ConstructorsConstructorDescriptionTransactionalRemoteCacheImpl(RemoteCacheManager rcm, String name, boolean forceReturnValue, boolean recoveryEnabled, TransactionManager transactionManager, TransactionTable transactionTable, TimeService timeService) -
Method Summary
Modifier and TypeMethodDescriptioncomputeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit).computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit).containsKeyAsync(K key) Asynchronous version ofMap.containsKey(Object)booleancontainsValue(Object value) Asynchronous version ofMap.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.getWithMetadataAsync(K key) Asynchronously returns theMetadataValueassociated to the supplied key param, or null if it doesn't exist.booleanputAllAsync(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Adds or overrides each specified entry in the remote cache.putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit).putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit).removeAsync(Object key) Asynchronous version ofBasicCache.remove(Object).removeAsync(Object key, Object value) Asynchronous version ofConcurrentMap.remove(Object, Object).removeWithVersionAsync(K key, long version) replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit).replaceAsync(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit).replaceWithVersionAsync(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit) Methods inherited from class org.infinispan.client.hotrod.impl.RemoteCacheImpl
addClientListener, addClientListener, addNearCacheListener, assertRemoteCacheManagerIsStarted, clearAsync, clientStatistics, computeAsync, continuousQuery, entryIterator, entrySet, execute, execute, getAllAsync, getCacheTopologyInfo, getDataFormat, getName, getOperationsFactory, getProtocolVersion, getRemoteCacheContainer, getVersion, getWithMetadataAsync, hasForceReturnFlag, init, init, isEmpty, isObjectStorage, keyIterator, keySet, keyToBytes, mergeAsync, ping, publishEntries, publishEntriesByQuery, publishEntriesWithMetadata, query, removeClientListener, replaceAll, resolveStorage, resolveStorage, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, serverStatistics, serverStatisticsAsync, sizeAsync, start, stop, streaming, toString, updateBloomFilter, values, valueToBytes, withDataFormat, withFlagsMethods inherited from class org.infinispan.client.hotrod.impl.RemoteCacheSupport
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, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.commons.api.AsyncCache
computeAsync, computeAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresentAsync, computeIfPresentAsync, mergeAsync, mergeAsync, putAsync, putAsync, putIfAbsentAsync, putIfAbsentAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsyncMethods inherited from interface org.infinispan.commons.api.BasicCache
compute, compute, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, merge, merge, put, put, put, putIfAbsent, putIfAbsent, replace, replaceMethods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, replaceMethods inherited from interface org.infinispan.client.hotrod.impl.InternalRemoteCache
removeEntry, removeEntryMethods inherited from interface org.infinispan.client.hotrod.RemoteCache
entrySet, execute, getAll, getRemoteCacheManager, getWithMetadata, keySet, putAll, putAll, putAll, putAllAsync, putAllAsync, remove, remove, removeWithVersion, replace, replace, replace, replaceWithVersion, replaceWithVersion, replaceWithVersion, replaceWithVersion, replaceWithVersionAsync, replaceWithVersionAsync, replaceWithVersionAsync, retrieveEntries, retrieveEntries, values
-
Constructor Details
-
TransactionalRemoteCacheImpl
public TransactionalRemoteCacheImpl(RemoteCacheManager rcm, String name, boolean forceReturnValue, boolean recoveryEnabled, TransactionManager transactionManager, TransactionTable transactionTable, TimeService timeService)
-
-
Method Details
-
removeWithVersionAsync
- Specified by:
removeWithVersionAsyncin interfaceRemoteCache<K,V> - Overrides:
removeWithVersionAsyncin classRemoteCacheImpl<K,V> - See Also:
-
replaceWithVersionAsync
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit) - Specified by:
replaceWithVersionAsyncin interfaceRemoteCache<K,V> - Overrides:
replaceWithVersionAsyncin classRemoteCacheImpl<K,V> - See Also:
-
getWithMetadataAsync
Description copied from interface:RemoteCacheAsynchronously returns theMetadataValueassociated to the supplied key param, or null if it doesn't exist.- Specified by:
getWithMetadataAsyncin interfaceRemoteCache<K,V> - Overrides:
getWithMetadataAsyncin classRemoteCacheImpl<K,V>
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:RemoteCacheAdds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsyncin interfaceAsyncCache<K,V> - Specified by:
putAllAsyncin interfaceRemoteCache<K,V> - Overrides:
putAllAsyncin classRemoteCacheImpl<K,V> - Parameters:
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 time- Returns:
- a future containing a void return type
- See Also:
-
putAsync
public CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsyncin interfaceAsyncCache<K,V> - Overrides:
putAsyncin classRemoteCacheImpl<K,V> - Parameters:
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 time- Returns:
- a future containing the old value replaced
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsyncin interfaceAsyncCache<K,V> - Overrides:
putIfAbsentAsyncin classRemoteCacheImpl<K,V> - Parameters:
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 time- Returns:
- a future containing the old value replaced
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Overrides:
replaceAsyncin classRemoteCacheImpl<K,V> - Parameters:
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 time- Returns:
- a future containing the previous value overwritten
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Overrides:
replaceAsyncin classRemoteCacheImpl<K,V> - Parameters:
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 time- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
containsKeyAsync
Description copied from interface:AsyncCacheAsynchronous version ofMap.containsKey(Object)- Specified by:
containsKeyAsyncin interfaceAsyncCache<K,V> - Overrides:
containsKeyAsyncin classRemoteCacheImpl<K,V> - Parameters:
key- key to retrieve- Returns:
- future containing true if the mapping exists.
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classRemoteCacheImpl<K,V>
-
getAsync
Description copied from interface:AsyncCacheAsynchronous version ofMap.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 toMap.get(Object).- Specified by:
getAsyncin interfaceAsyncCache<K,V> - Overrides:
getAsyncin classRemoteCacheImpl<K,V> - Parameters:
key- key to retrieve- Returns:
- a future that can be used to retrieve value associated with the
key when this is available. The actual value returned by the future
follows the same rules as
Map.get(Object)
-
removeAsync
Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.remove(Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
removeAsyncin interfaceAsyncCache<K,V> - Overrides:
removeAsyncin classRemoteCacheImpl<K,V> - Parameters:
key- key to remove- Returns:
- a future containing the value removed
-
removeAsync
Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.remove(Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
removeAsyncin interfaceAsyncCache<K,V> - Overrides:
removeAsyncin classRemoteCacheImpl<K,V> - Parameters:
key- key to removevalue- value to match on- Returns:
- a future containing a boolean, indicating whether the entry was removed or not
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsyncin interfaceAsyncCache<K,V> - Overrides:
computeIfAbsentAsyncin classRemoteCacheImpl<K,V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsyncin interfaceAsyncCache<K,V> - Overrides:
computeIfPresentAsyncin classRemoteCacheImpl<K,V>
-
getTransactionManager
- Returns:
- the
TransactionManagerin use by this cache ornullif the cache isn't transactional.
-
isTransactional
public boolean isTransactional()- Specified by:
isTransactionalin interfaceRemoteCache<K,V> - Overrides:
isTransactionalin classRemoteCacheImpl<K,V> - Returns:
trueif the cache can participate in a transaction,falseotherwise.
-