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>
,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
public class TransactionalRemoteCacheImpl<K,V> extends RemoteCacheImpl<K,V>
ARemoteCache
implementation that handlesTransaction
.All streaming operation (example
RemoteCacheImpl.retrieveEntries(String, int)
) andRemoteCacheImpl.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 fpr the transaction.- Since:
- 9.3
- Author:
- Pedro Ruivo
-
-
Field Summary
-
Fields inherited from class org.infinispan.client.hotrod.impl.RemoteCacheImpl
operationsFactory
-
Fields inherited from class org.infinispan.client.hotrod.impl.RemoteCacheSupport
defaultLifespan, defaultMaxIdleTime
-
-
Constructor Summary
Constructors Constructor Description TransactionalRemoteCacheImpl(RemoteCacheManager rcm, String name, boolean forceReturnValue, TransactionManager transactionManager, TransactionTable transactionTable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkTransactionSupport()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
V
get(Object key)
TransactionManager
getTransactionManager()
VersionedValue<V>
getVersioned(K key)
Returns theVersionedValue
associated to the supplied key param, or null if it doesn't exist.MetadataValue<V>
getWithMetadata(K key)
Returns theMetadataValue
associated to the supplied key param, or null if it doesn't exist.CompletableFuture<Void>
putAllAsync(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
Synthetic operation.CompletableFuture<V>
putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
CompletableFuture<V>
putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
boolean
remove(Object key, Object value)
CompletableFuture<V>
removeAsync(Object key)
CompletableFuture<Boolean>
removeWithVersionAsync(K key, long version)
boolean
replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
CompletableFuture<V>
replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
CompletableFuture<Boolean>
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, assertRemoteCacheManagerIsStarted, clear, clearAsync, entrySet, execute, execute, getAll, getAsync, getBulk, getBulk, getCacheTopologyInfo, getDataFormat, getListeners, getName, getOperationsFactory, getProtocolVersion, getRemoteCacheManager, getVersion, hasCompatibility, init, isEmpty, keySet, keyToBytes, ping, put, putAll, putIfAbsent, remove, removeClientListener, removeWithVersion, replace, replaceWithVersion, replaceWithVersion, replaceWithVersionAsync, resolveCompatibility, retrieveEntries, retrieveEntries, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, set, size, start, stats, stop, streaming, values, valueToBytes, withDataFormat, withFlags
-
Methods inherited from class org.infinispan.client.hotrod.impl.RemoteCacheSupport
merge, merge, merge, put, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putAsync, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, removeAsync, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceWithVersion, replaceWithVersion, replaceWithVersionAsync, replaceWithVersionAsync
-
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
containsKeyAsync, getAllAsync
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, replaceAll
-
-
-
-
Constructor Detail
-
TransactionalRemoteCacheImpl
public TransactionalRemoteCacheImpl(RemoteCacheManager rcm, String name, boolean forceReturnValue, TransactionManager transactionManager, TransactionTable transactionTable)
-
-
Method Detail
-
removeWithVersionAsync
public CompletableFuture<Boolean> removeWithVersionAsync(K key, long version)
- Specified by:
removeWithVersionAsync
in interfaceRemoteCache<K,V>
- Overrides:
removeWithVersionAsync
in classRemoteCacheImpl<K,V>
- See Also:
RemoteCache.remove(Object, Object)
-
replaceWithVersionAsync
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit)
- Overrides:
replaceWithVersionAsync
in classRemoteCacheImpl<K,V>
-
getVersioned
public VersionedValue<V> getVersioned(K key)
Description copied from interface:RemoteCache
Returns theVersionedValue
associated to the supplied key param, or null if it doesn't exist.- Specified by:
getVersioned
in interfaceRemoteCache<K,V>
- Overrides:
getVersioned
in classRemoteCacheImpl<K,V>
-
getWithMetadata
public MetadataValue<V> getWithMetadata(K key)
Description copied from interface:RemoteCache
Returns theMetadataValue
associated to the supplied key param, or null if it doesn't exist.- Specified by:
getWithMetadata
in interfaceRemoteCache<K,V>
- Overrides:
getWithMetadata
in 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:RemoteCache
Synthetic operation.- Specified by:
putAllAsync
in interfaceorg.infinispan.commons.api.AsyncCache<K,V>
- Specified by:
putAllAsync
in interfaceRemoteCache<K,V>
- Overrides:
putAllAsync
in classRemoteCacheImpl<K,V>
- See Also:
RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
-
putAsync
public CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
- Specified by:
putIfAbsentAsync
in interfaceorg.infinispan.commons.api.AsyncCache<K,V>
- Overrides:
putIfAbsentAsync
in classRemoteCacheImpl<K,V>
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
- Specified by:
replaceAsync
in interfaceorg.infinispan.commons.api.AsyncCache<K,V>
- Overrides:
replaceAsync
in classRemoteCacheImpl<K,V>
-
replace
public boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
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)
if possible.- Specified by:
replace
in interfaceorg.infinispan.commons.api.BasicCache<K,V>
- Specified by:
replace
in interfaceRemoteCache<K,V>
- Overrides:
replace
in classRemoteCacheImpl<K,V>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<K,V>
- Overrides:
containsKey
in classRemoteCacheImpl<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<K,V>
- Overrides:
containsValue
in classRemoteCacheImpl<K,V>
-
removeAsync
public CompletableFuture<V> removeAsync(Object key)
- Specified by:
removeAsync
in interfaceorg.infinispan.commons.api.AsyncCache<K,V>
- Overrides:
removeAsync
in classRemoteCacheImpl<K,V>
-
remove
public boolean remove(Object key, Object value)
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 remove the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.removeWithVersion(Object, long)
.
-
getTransactionManager
public TransactionManager getTransactionManager()
-
checkTransactionSupport
public void checkTransactionSupport()
-
-