public class CacheImpl<K,V> extends java.lang.Object implements AdvancedCache<K,V>
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ExecutorService |
asyncExecutor |
protected org.infinispan.batch.BatchContainer |
batchContainer |
private org.infinispan.manager.EmbeddedCacheManager |
cacheManager |
protected org.infinispan.commands.CommandsFactory |
commandsFactory |
protected org.infinispan.factories.ComponentRegistry |
componentRegistry |
protected Configuration |
config |
private org.infinispan.container.DataContainer |
dataContainer |
protected org.infinispan.metadata.Metadata |
defaultMetadata |
private org.infinispan.distribution.DistributionManager |
distributionManager |
private org.infinispan.eviction.EvictionManager |
evictionManager |
private GlobalConfiguration |
globalCfg |
protected org.infinispan.context.InvocationContextContainer |
icc |
protected org.infinispan.context.InvocationContextFactory |
invocationContextFactory |
protected org.infinispan.interceptors.InterceptorChain |
invoker |
private boolean |
isClassLoaderInContext |
private org.infinispan.util.concurrent.locks.LockManager |
lockManager |
private static org.infinispan.util.logging.Log |
log |
protected StreamingMarshaller |
marshaller |
private java.lang.String |
name |
protected org.infinispan.notifications.cachelistener.CacheNotifier |
notifier |
static java.lang.String |
OBJECT_NAME |
private org.infinispan.transaction.xa.recovery.RecoveryManager |
recoveryManager |
protected org.infinispan.remoting.rpc.RpcManager |
rpcManager |
private static boolean |
trace |
protected TransactionManager |
transactionManager |
private org.infinispan.transaction.TransactionCoordinator |
txCoordinator |
private org.infinispan.transaction.TransactionTable |
txTable |
Constructor and Description |
---|
CacheImpl(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
addInterceptor(org.infinispan.interceptors.base.CommandInterceptor i,
int position)
Adds a custom interceptor to the interceptor chain, at specified position, where the first interceptor in the
chain is at position 0 and the last one at NUM_INTERCEPTORS - 1.
|
boolean |
addInterceptorAfter(org.infinispan.interceptors.base.CommandInterceptor i,
java.lang.Class<? extends org.infinispan.interceptors.base.CommandInterceptor> afterInterceptor)
Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type.
|
boolean |
addInterceptorBefore(org.infinispan.interceptors.base.CommandInterceptor i,
java.lang.Class<? extends org.infinispan.interceptors.base.CommandInterceptor> beforeInterceptor)
Adds a custom interceptor to the interceptor chain, before an instance of the specified interceptor type.
|
void |
addListener(java.lang.Object listener)
Adds a listener to the component.
|
void |
addListener(java.lang.Object listener,
org.infinispan.notifications.KeyFilter filter)
Adds a listener to the component.
|
void |
applyDelta(K deltaAwareValueKey,
org.infinispan.atomic.Delta delta,
java.lang.Object... locksToAcquire)
Applies the given Delta to the DeltaAware object stored under deltaAwareValueKey if and only if all
locksToAcquire locks are successfully obtained
|
private void |
assertKeyNotNull(java.lang.Object key) |
private void |
assertKeysNotNull(java.util.Map<?,?> data) |
private void |
assertKeyValueNotNull(java.lang.Object key,
java.lang.Object value) |
private void |
assertValueNotNull(java.lang.Object value) |
private void |
associateImplicitTransactionWithCurrentThread(org.infinispan.context.InvocationContext ctx) |
private boolean |
asyncSkipsThread(java.util.EnumSet<org.infinispan.context.Flag> flags,
K key)
Encodes the cases for an asyncGet operation in which it makes sense to actually perform the operation in sync.
|
void |
clear() |
(package private) void |
clear(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
clearAsync()
Asynchronous version of
#clear() . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
clearAsync(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
private void |
clearInternal(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
void |
clearOperation() |
boolean |
containsKey(java.lang.Object key) |
(package private) boolean |
containsKey(java.lang.Object key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
boolean |
containsValue(java.lang.Object value) |
private org.infinispan.context.InvocationContext |
createSingleKeyNonTxInvocationContext(java.lang.ClassLoader explicitClassLoader) |
void |
endBatch(boolean successful) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this cache and cache loader.
|
(package private) java.util.Set<java.util.Map.Entry<K,V>> |
entrySet(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
void |
evict(K key)
Evicts an entry from the memory of the cache.
|
(package private) void |
evict(K key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
private java.lang.Object |
executeCommandAndCommitIfNeeded(org.infinispan.context.InvocationContext ctx,
org.infinispan.commands.VisitableCommand command) |
V |
get(java.lang.Object key) |
(package private) V |
get(java.lang.Object key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
AdvancedCache<K,V> |
getAdvancedCache() |
org.infinispan.util.concurrent.NotifyingFuture<V> |
getAsync(K key)
Asynchronous version of
#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. |
(package private) org.infinispan.util.concurrent.NotifyingFuture<V> |
getAsync(K key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.batch.BatchContainer |
getBatchContainer()
Returns the component in charge of batching cache operations.
|
Configuration |
getCacheConfiguration() |
org.infinispan.container.entries.CacheEntry |
getCacheEntry(K key)
Retrieves a CacheEntry corresponding to a specific key.
|
org.infinispan.container.entries.CacheEntry |
getCacheEntry(java.lang.Object key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.manager.EmbeddedCacheManager |
getCacheManager()
Retrieves the cache manager responsible for creating this cache instance.
|
java.lang.String |
getCacheName()
Returns the cache name.
|
java.lang.String |
getCacheStatus()
Returns String representation of ComponentStatus enumeration in order to avoid class not found exceptions in JMX
tools that don't have access to infinispan classes.
|
java.lang.ClassLoader |
getClassLoader()
Returns the cache loader associated associated with this cache.
|
org.infinispan.factories.ComponentRegistry |
getComponentRegistry() |
java.util.Properties |
getConfigurationAsProperties() |
org.infinispan.container.DataContainer |
getDataContainer()
Returns the container where data is stored in the cache.
|
org.infinispan.distribution.DistributionManager |
getDistributionManager()
Retrieves a reference to the
DistributionManager if the cache is configured
to use Distribution. |
org.infinispan.eviction.EvictionManager |
getEvictionManager() |
java.util.List<org.infinispan.interceptors.base.CommandInterceptor> |
getInterceptorChain()
Retrieves the current Interceptor chain.
|
private org.infinispan.context.InvocationContext |
getInvocationContext(Transaction tx,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.context.InvocationContextContainer |
getInvocationContextContainer()
Returns the component in charge of managing the interactions between the
cache operations and the context information associated with them.
|
private org.infinispan.context.InvocationContext |
getInvocationContextForRead(Transaction tx,
java.lang.ClassLoader explicitClassLoader,
int keyCount) |
private org.infinispan.context.InvocationContext |
getInvocationContextForWrite(java.lang.ClassLoader explicitClassLoader,
int keyCount,
boolean isPutForExternalRead) |
private org.infinispan.context.InvocationContext |
getInvocationContextWithImplicitTransaction(boolean isPutForExternalRead,
java.lang.ClassLoader explicitClassLoader,
int keyCount)
If this is a transactional cache and autoCommit is set to true then starts a transaction if this is
not a transactional call.
|
private org.infinispan.context.InvocationContext |
getInvocationContextWithImplicitTransactionForAsyncOps(boolean isPutForExternalRead,
java.lang.ClassLoader explicitClassLoader,
int keyCount) |
java.util.Set<java.lang.Object> |
getListeners() |
org.infinispan.util.concurrent.locks.LockManager |
getLockManager()
Returns the component that deals with all aspects of acquiring and
releasing locks for cache entries.
|
java.lang.String |
getName() |
private Transaction |
getOngoingTransaction() |
org.infinispan.remoting.rpc.RpcManager |
getRpcManager()
Returns the component in charge of communication with other caches in
the cluster.
|
org.infinispan.stats.Stats |
getStats()
Returns a
Stats object that allows several statistics associated
with this cache at runtime. |
org.infinispan.lifecycle.ComponentStatus |
getStatus() |
TransactionManager |
getTransactionManager()
Returns the transaction manager configured for this cache.
|
java.lang.String |
getVersion()
Returns the cache configuration as XML string.
|
javax.transaction.xa.XAResource |
getXAResource()
Returns the
XAResource associated with this cache which can be
used to do transactional recovery. |
void |
injectDependencies(org.infinispan.eviction.EvictionManager evictionManager,
org.infinispan.context.InvocationContextFactory invocationContextFactory,
org.infinispan.context.InvocationContextContainer icc,
org.infinispan.commands.CommandsFactory commandsFactory,
org.infinispan.interceptors.InterceptorChain interceptorChain,
Configuration configuration,
org.infinispan.notifications.cachelistener.CacheNotifier notifier,
org.infinispan.factories.ComponentRegistry componentRegistry,
TransactionManager transactionManager,
org.infinispan.batch.BatchContainer batchContainer,
org.infinispan.remoting.rpc.RpcManager rpcManager,
org.infinispan.container.DataContainer dataContainer,
StreamingMarshaller marshaller,
org.infinispan.distribution.DistributionManager distributionManager,
org.infinispan.manager.EmbeddedCacheManager cacheManager,
java.util.concurrent.ExecutorService asyncExecutor,
org.infinispan.transaction.TransactionTable txTable,
org.infinispan.transaction.xa.recovery.RecoveryManager recoveryManager,
org.infinispan.transaction.TransactionCoordinator txCoordinator,
org.infinispan.util.concurrent.locks.LockManager lockManager,
GlobalConfiguration globalCfg) |
boolean |
isEmpty() |
(package private) boolean |
isEmpty(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
private boolean |
isPutForExternalRead(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags) |
private boolean |
isSkipLoader(java.util.EnumSet<org.infinispan.context.Flag> flags) |
private boolean |
isTxInjected(org.infinispan.context.InvocationContext ctx) |
java.util.Set<K> |
keySet()
Returns a set view of the keys contained in this cache and cache loader.
|
(package private) java.util.Set<K> |
keySet(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
boolean |
lock(java.util.Collection<? extends K> keys)
Locks collections of keys eagerly across cache nodes in a cluster.
|
(package private) boolean |
lock(java.util.Collection<? extends K> keys,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
boolean |
lock(K... keys)
Locks a given key or keys eagerly across cache nodes in a cluster.
|
V |
put(K key,
V value) |
V |
put(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
V |
put(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit idleTimeUnit) |
V |
put(K key,
V value,
org.infinispan.metadata.Metadata metadata)
An overloaded form of
#put(K, V) , which takes in an instance of
Metadata which can be used to provide metadata information for
the entry being stored, such as lifespan, version of value...etc. |
(package private) V |
put(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
void |
putAll(java.util.Map<? extends K,? extends V> map,
long lifespan,
java.util.concurrent.TimeUnit unit) |
void |
putAll(java.util.Map<? extends K,? extends V> map,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit idleTimeUnit) |
(package private) void |
putAll(java.util.Map<? extends K,? extends V> map,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data)
Asynchronous version of
#putAll(Map) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#putAll(Map, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#putAll(Map, long, TimeUnit, long, TimeUnit) . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
private void |
putAllInternal(java.util.Map<? extends K,? extends V> map,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value)
Asynchronous version of
#put(Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#put(Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#put(Object, Object, long, TimeUnit, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value,
org.infinispan.metadata.Metadata metadata)
Asynchronous version of
AdvancedCache.put(Object, Object, Metadata) which stores
metadata alongside the value. |
(package private) org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
void |
putForExternalRead(K key,
V value)
Under special operating behavior, associates the value with the specified key.
|
(package private) void |
putForExternalRead(K key,
V value,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
V |
putIfAbsent(K key,
V value) |
V |
putIfAbsent(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
V |
putIfAbsent(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit idleTimeUnit) |
V |
putIfAbsent(K key,
V value,
org.infinispan.metadata.Metadata metadata)
An overloaded form of
#putIfAbsent(K, V) , which takes in an
instance of Metadata which can be used to provide metadata
information for the entry being stored, such as lifespan, version
of value...etc. |
(package private) V |
putIfAbsent(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value)
Asynchronous version of
#putIfAbsent(Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#putIfAbsent(Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit) . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
private V |
putIfAbsentInternal(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
private V |
putInternal(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
V |
remove(java.lang.Object key) |
(package private) V |
remove(java.lang.Object key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
(package private) boolean |
remove(java.lang.Object key,
java.lang.Object value,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
removeAsync(java.lang.Object key)
Asynchronous version of
#remove(Object) . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<V> |
removeAsync(java.lang.Object key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
removeAsync(java.lang.Object key,
java.lang.Object value)
Asynchronous version of
#remove(Object, Object) . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
removeAsync(java.lang.Object key,
java.lang.Object value,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
void |
removeInterceptor(java.lang.Class<? extends org.infinispan.interceptors.base.CommandInterceptor> interceptorType)
Removes the interceptor of specified type.
|
void |
removeInterceptor(int position)
Removes the interceptor at a specified position, where the first interceptor in the chain is at position 0 and the
last one at getInterceptorChain().size() - 1.
|
private V |
removeInternal(java.lang.Object key,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
private boolean |
removeInternal(java.lang.Object key,
java.lang.Object value,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
void |
removeListener(java.lang.Object listener)
Removes a listener from the component.
|
V |
replace(K key,
V value) |
V |
replace(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
V |
replace(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit idleTimeUnit) |
V |
replace(K key,
V value,
org.infinispan.metadata.Metadata metadata)
An overloaded form of
#replace(K, V) , which takes in an
instance of Metadata which can be used to provide metadata
information for the entry being stored, such as lifespan, version
of value...etc. |
(package private) V |
replace(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
boolean |
replace(K key,
V oldValue,
V newValue) |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit idleTimeUnit) |
boolean |
replace(K key,
V oldValue,
V value,
org.infinispan.metadata.Metadata metadata)
An overloaded form of
#replace(K, V, V) , which takes in an
instance of Metadata which can be used to provide metadata
information for the entry being stored, such as lifespan, version
of value...etc. |
(package private) boolean |
replace(K key,
V oldValue,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value)
Asynchronous version of
#replace(Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#replace(Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#replace(Object, Object, long, TimeUnit, long, TimeUnit) . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronous version of
#replace(Object, Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#replace(Object, Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#replace(Object, Object, Object, long, TimeUnit, long, TimeUnit) . |
(package private) org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
private V |
replaceInternal(K key,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
private boolean |
replaceInternal(K key,
V oldValue,
V value,
org.infinispan.metadata.Metadata metadata,
java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
org.infinispan.context.InvocationContext ctx) |
private org.infinispan.context.InvocationContext |
setInvocationContextClassLoader(org.infinispan.context.InvocationContext ctx,
java.lang.ClassLoader explicitClassLoader) |
int |
size()
Returns a count of all elements in this cache and cache loader.
|
(package private) int |
size(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
void |
start() |
boolean |
startBatch() |
void |
stop() |
(package private) void |
stop(java.lang.ClassLoader explicitClassLoader) |
java.lang.String |
toString() |
private void |
tryRollback() |
java.util.Collection<V> |
values()
Returns a collection view of the values contained in this cache.
|
(package private) java.util.Collection<V> |
values(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags,
java.lang.ClassLoader explicitClassLoader) |
AdvancedCache<K,V> |
with(java.lang.ClassLoader classLoader)
Using this operation, users can call any
AdvancedCache operation
with a given ClassLoader . |
AdvancedCache<K,V> |
withFlags(org.infinispan.context.Flag... flags)
A method that adds flags to any API call.
|
private <X> org.infinispan.util.concurrent.NotifyingFuture<X> |
wrapInFuture(java.lang.Object retval)
Wraps a return value as a future, if needed.
|
public static final java.lang.String OBJECT_NAME
protected org.infinispan.context.InvocationContextContainer icc
protected org.infinispan.context.InvocationContextFactory invocationContextFactory
protected org.infinispan.commands.CommandsFactory commandsFactory
protected org.infinispan.interceptors.InterceptorChain invoker
protected Configuration config
protected org.infinispan.notifications.cachelistener.CacheNotifier notifier
protected org.infinispan.batch.BatchContainer batchContainer
protected org.infinispan.factories.ComponentRegistry componentRegistry
protected TransactionManager transactionManager
protected org.infinispan.remoting.rpc.RpcManager rpcManager
protected StreamingMarshaller marshaller
protected org.infinispan.metadata.Metadata defaultMetadata
private final java.lang.String name
private org.infinispan.eviction.EvictionManager evictionManager
private org.infinispan.container.DataContainer dataContainer
private static final org.infinispan.util.logging.Log log
private static final boolean trace
private org.infinispan.manager.EmbeddedCacheManager cacheManager
private org.infinispan.util.concurrent.locks.LockManager lockManager
private org.infinispan.distribution.DistributionManager distributionManager
private java.util.concurrent.ExecutorService asyncExecutor
private org.infinispan.transaction.TransactionTable txTable
private org.infinispan.transaction.xa.recovery.RecoveryManager recoveryManager
private org.infinispan.transaction.TransactionCoordinator txCoordinator
private GlobalConfiguration globalCfg
private boolean isClassLoaderInContext
public void injectDependencies(org.infinispan.eviction.EvictionManager evictionManager, org.infinispan.context.InvocationContextFactory invocationContextFactory, org.infinispan.context.InvocationContextContainer icc, org.infinispan.commands.CommandsFactory commandsFactory, org.infinispan.interceptors.InterceptorChain interceptorChain, Configuration configuration, org.infinispan.notifications.cachelistener.CacheNotifier notifier, org.infinispan.factories.ComponentRegistry componentRegistry, TransactionManager transactionManager, org.infinispan.batch.BatchContainer batchContainer, org.infinispan.remoting.rpc.RpcManager rpcManager, org.infinispan.container.DataContainer dataContainer, StreamingMarshaller marshaller, org.infinispan.distribution.DistributionManager distributionManager, org.infinispan.manager.EmbeddedCacheManager cacheManager, java.util.concurrent.ExecutorService asyncExecutor, org.infinispan.transaction.TransactionTable txTable, org.infinispan.transaction.xa.recovery.RecoveryManager recoveryManager, org.infinispan.transaction.TransactionCoordinator txCoordinator, org.infinispan.util.concurrent.locks.LockManager lockManager, GlobalConfiguration globalCfg)
private void assertKeyNotNull(java.lang.Object key)
private void assertKeyValueNotNull(java.lang.Object key, java.lang.Object value)
private void assertValueNotNull(java.lang.Object value)
private void assertKeysNotNull(java.util.Map<?,?> data)
public final V putIfAbsent(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
public final void putAll(java.util.Map<? extends K,? extends V> map, long lifespan, java.util.concurrent.TimeUnit unit)
public final boolean replace(K key, V oldValue, V value, long lifespan, java.util.concurrent.TimeUnit unit)
public final org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value)
org.infinispan.api.BasicCache
#put(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over #put(Object, Object)
if used in LOCAL mode.
public final org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.BasicCache
#put(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous. Has no benefit over #put(Object, Object, long, TimeUnit)
if used in LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data)
org.infinispan.api.BasicCache
#putAll(Map)
. This method does not block on remote calls, even if your cache mode
is synchronous. Has no benefit over #putAll(Map)
if used in LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.BasicCache
#putAll(Map, long, TimeUnit)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over #putAll(Map, long, TimeUnit)
if used in LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value)
org.infinispan.api.BasicCache
#putIfAbsent(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over #putIfAbsent(Object, Object)
if used in LOCAL mode.
public final org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.BasicCache
#putIfAbsent(Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over #putIfAbsent(Object, Object,
long, TimeUnit)
if used in LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value)
org.infinispan.api.BasicCache
#replace(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over #replace(Object, Object)
if used in LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.BasicCache
#replace(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, long,
TimeUnit)
if used in LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue)
org.infinispan.api.BasicCache
#replace(Object, Object, Object)
. This method does not block on remote calls,
even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, Object)
if used in
LOCAL mode.public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.BasicCache
#replace(Object, Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, Object,
long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface org.infinispan.api.BasicCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic final boolean remove(java.lang.Object key, java.lang.Object value)
final boolean remove(java.lang.Object key, java.lang.Object value, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private boolean removeInternal(java.lang.Object key, java.lang.Object value, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public final int size()
Cache
org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local keys will be loaded into memory at once.
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.
final int size(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final boolean isEmpty()
final boolean isEmpty(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final boolean containsKey(java.lang.Object key)
final boolean containsKey(java.lang.Object key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final boolean containsValue(java.lang.Object value)
public final V get(java.lang.Object key)
final V get(java.lang.Object key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.container.entries.CacheEntry getCacheEntry(java.lang.Object key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.container.entries.CacheEntry getCacheEntry(K key)
AdvancedCache
getCacheEntry
in interface AdvancedCache<K,V>
key
- the key whose associated cache entry is to be returnednull
if this map contains no mapping for the keypublic final V remove(java.lang.Object key)
final V remove(java.lang.Object key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private V removeInternal(java.lang.Object key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public final void clearOperation()
public final void clear()
final void clear(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private void clearInternal(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public java.util.Set<K> keySet()
Cache
org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local keys will be in memory at once.
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.
java.util.Set<K> keySet(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public java.util.Collection<V> values()
Cache
org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local values will be in memory at once.
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.
java.util.Collection<V> values(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Cache
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.
If there are memory concerns then the org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local entries will be in memory at once.
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.
java.util.Set<java.util.Map.Entry<K,V>> entrySet(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final void putForExternalRead(K key, V value)
Cache
ConcurrentMap.putIfAbsent(Object, Object)
)
putForExternalRead
in interface Cache<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.final void putForExternalRead(K key, V value, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final void evict(K key)
Cache
#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.final void evict(K key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private org.infinispan.context.InvocationContext createSingleKeyNonTxInvocationContext(java.lang.ClassLoader explicitClassLoader)
public Configuration getCacheConfiguration()
getCacheConfiguration
in interface Cache<K,V>
public void addListener(java.lang.Object listener)
org.infinispan.notifications.Listenable
Listener
and
further to that, contain methods annotated appropriately, otherwise the listener will not be registered.
See the Listener
annotation for more information.
addListener
in interface org.infinispan.notifications.Listenable
listener
- must not be null.public void addListener(java.lang.Object listener, org.infinispan.notifications.KeyFilter filter)
org.infinispan.notifications.FilteringListenable
Listener
and
further to that, contain methods annotated appropriately, otherwise the listener will not be registered.
See the Listener
annotation for more information.
addListener
in interface org.infinispan.notifications.FilteringListenable
listener
- must not be null.public void removeListener(java.lang.Object listener)
org.infinispan.notifications.Listenable
removeListener
in interface org.infinispan.notifications.Listenable
listener
- listener to remove. Must not be null.public java.util.Set<java.lang.Object> getListeners()
getListeners
in interface org.infinispan.notifications.Listenable
private org.infinispan.context.InvocationContext getInvocationContextForWrite(java.lang.ClassLoader explicitClassLoader, int keyCount, boolean isPutForExternalRead)
private org.infinispan.context.InvocationContext getInvocationContextForRead(Transaction tx, java.lang.ClassLoader explicitClassLoader, int keyCount)
private org.infinispan.context.InvocationContext getInvocationContextWithImplicitTransactionForAsyncOps(boolean isPutForExternalRead, java.lang.ClassLoader explicitClassLoader, int keyCount)
private org.infinispan.context.InvocationContext getInvocationContextWithImplicitTransaction(boolean isPutForExternalRead, java.lang.ClassLoader explicitClassLoader, int keyCount)
private boolean isPutForExternalRead(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags)
private org.infinispan.context.InvocationContext getInvocationContext(Transaction tx, java.lang.ClassLoader explicitClassLoader)
private org.infinispan.context.InvocationContext setInvocationContextClassLoader(org.infinispan.context.InvocationContext ctx, java.lang.ClassLoader explicitClassLoader)
public boolean lock(K... keys)
AdvancedCache
Keys can be locked eagerly in the context of a transaction only.
lock
in interface AdvancedCache<K,V>
keys
- the keys to lockFlag.FAIL_SILENTLY
.public boolean lock(java.util.Collection<? extends K> keys)
AdvancedCache
Collections of keys can be locked eagerly in the context of a transaction only.
lock
in interface AdvancedCache<K,V>
keys
- collection of keys to lockFlag.FAIL_SILENTLY
.boolean lock(java.util.Collection<? extends K> keys, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public void applyDelta(K deltaAwareValueKey, org.infinispan.atomic.Delta delta, java.lang.Object... locksToAcquire)
AdvancedCache
applyDelta
in interface AdvancedCache<K,V>
deltaAwareValueKey
- the key for DeltaAware objectdelta
- the delta to be applied to DeltaAware objectlocksToAcquire
- keys to be locked in DeltaAware scopepublic void start()
public void stop()
void stop(java.lang.ClassLoader explicitClassLoader)
public java.util.List<org.infinispan.interceptors.base.CommandInterceptor> getInterceptorChain()
AdvancedCache
getInterceptorChain
in interface AdvancedCache<K,V>
List
of CommandInterceptor
s
configured for this cachepublic void addInterceptor(org.infinispan.interceptors.base.CommandInterceptor i, int position)
AdvancedCache
addInterceptor
in interface AdvancedCache<K,V>
i
- the interceptor to addposition
- the position to add the interceptorpublic boolean addInterceptorAfter(org.infinispan.interceptors.base.CommandInterceptor i, java.lang.Class<? extends org.infinispan.interceptors.base.CommandInterceptor> afterInterceptor)
AdvancedCache
addInterceptorAfter
in interface AdvancedCache<K,V>
i
- interceptor to addafterInterceptor
- interceptor type after which to place custom interceptorpublic boolean addInterceptorBefore(org.infinispan.interceptors.base.CommandInterceptor i, java.lang.Class<? extends org.infinispan.interceptors.base.CommandInterceptor> beforeInterceptor)
AdvancedCache
addInterceptorBefore
in interface AdvancedCache<K,V>
i
- interceptor to addbeforeInterceptor
- interceptor type before which to place custom interceptorpublic void removeInterceptor(int position)
AdvancedCache
removeInterceptor
in interface AdvancedCache<K,V>
position
- the position at which to remove an interceptorpublic void removeInterceptor(java.lang.Class<? extends org.infinispan.interceptors.base.CommandInterceptor> interceptorType)
AdvancedCache
removeInterceptor
in interface AdvancedCache<K,V>
interceptorType
- type of interceptor to removepublic org.infinispan.eviction.EvictionManager getEvictionManager()
getEvictionManager
in interface AdvancedCache<K,V>
public org.infinispan.factories.ComponentRegistry getComponentRegistry()
getComponentRegistry
in interface AdvancedCache<K,V>
public org.infinispan.distribution.DistributionManager getDistributionManager()
AdvancedCache
DistributionManager
if the cache is configured
to use Distribution. Otherwise, returns a null.getDistributionManager
in interface AdvancedCache<K,V>
public org.infinispan.lifecycle.ComponentStatus getStatus()
public java.lang.String getCacheStatus()
public boolean startBatch()
public void endBatch(boolean successful)
public java.lang.String getName()
public java.lang.String getCacheName()
public java.lang.String getVersion()
public java.lang.String toString()
toString
in class java.lang.Object
public org.infinispan.batch.BatchContainer getBatchContainer()
AdvancedCache
getBatchContainer
in interface AdvancedCache<K,V>
public org.infinispan.context.InvocationContextContainer getInvocationContextContainer()
AdvancedCache
getInvocationContextContainer
in interface AdvancedCache<K,V>
public org.infinispan.container.DataContainer getDataContainer()
AdvancedCache
getDataContainer
in interface AdvancedCache<K,V>
public TransactionManager getTransactionManager()
AdvancedCache
getTransactionManager
in interface AdvancedCache<K,V>
public org.infinispan.util.concurrent.locks.LockManager getLockManager()
AdvancedCache
getLockManager
in interface AdvancedCache<K,V>
public org.infinispan.manager.EmbeddedCacheManager getCacheManager()
Cache
getCacheManager
in interface Cache<K,V>
public org.infinispan.stats.Stats getStats()
AdvancedCache
Stats
object that allows several statistics associated
with this cache at runtime.getStats
in interface AdvancedCache<K,V>
Stats
objectpublic javax.transaction.xa.XAResource getXAResource()
AdvancedCache
XAResource
associated with this cache which can be
used to do transactional recovery.getXAResource
in interface AdvancedCache<K,V>
XAResource
public final V put(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit idleTimeUnit)
final V put(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private V putInternal(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public final V putIfAbsent(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit idleTimeUnit)
final V putIfAbsent(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private V putIfAbsentInternal(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public final void putAll(java.util.Map<? extends K,? extends V> map, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit idleTimeUnit)
final void putAll(java.util.Map<? extends K,? extends V> map, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private void putAllInternal(java.util.Map<? extends K,? extends V> map, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public final V replace(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit idleTimeUnit)
final V replace(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private V replaceInternal(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
public final boolean replace(K key, V oldValue, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit idleTimeUnit)
final boolean replace(K key, V oldValue, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private boolean replaceInternal(K key, V oldValue, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, org.infinispan.context.InvocationContext ctx)
private <X> org.infinispan.util.concurrent.NotifyingFuture<X> wrapInFuture(java.lang.Object retval)
X
- contents of the futureretval
- return value to wrappublic final org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.BasicCache
#put(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block
on remote calls, even if your cache mode is synchronous. Has no benefit over #put(Object, Object, long,
TimeUnit, long, TimeUnit)
if used in LOCAL mode.putAsync
in interface org.infinispan.api.BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timefinal org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.BasicCache
#putAll(Map, long, TimeUnit, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over #putAll(Map, long, TimeUnit,
long, TimeUnit)
if used in LOCAL mode.putAllAsync
in interface org.infinispan.api.BasicCache<K,V>
data
- to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timefinal org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> clearAsync()
org.infinispan.api.BasicCache
#clear()
. This method does not block on remote calls, even if your cache mode is
synchronous. Has no benefit over #clear()
if used in LOCAL mode.final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> clearAsync(java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.BasicCache
#putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does
not block on remote calls, even if your cache mode is synchronous. Has no benefit over #putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.putIfAbsentAsync
in interface org.infinispan.api.BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timefinal org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<V> removeAsync(java.lang.Object key)
org.infinispan.api.BasicCache
#remove(Object)
. This method does not block on remote calls, even if your cache
mode is synchronous. Has no benefit over #remove(Object)
if used in LOCAL mode.final org.infinispan.util.concurrent.NotifyingFuture<V> removeAsync(java.lang.Object key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> removeAsync(java.lang.Object key, java.lang.Object value)
org.infinispan.api.BasicCache
#remove(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over #remove(Object, Object)
if used in LOCAL mode.final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> removeAsync(java.lang.Object key, java.lang.Object value, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.BasicCache
#replace(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not
block on remote calls, even if your cache mode is synchronous. Has no benefit over #replace(Object,
Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface org.infinispan.api.BasicCache<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timefinal org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public final org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.BasicCache
#replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
. This method
does not block on remote calls, even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface org.infinispan.api.BasicCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timefinal org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue, org.infinispan.metadata.Metadata metadata, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
public org.infinispan.util.concurrent.NotifyingFuture<V> getAsync(K key)
org.infinispan.api.BasicCache
#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 #get(Object)
.org.infinispan.util.concurrent.NotifyingFuture<V> getAsync(K key, java.util.EnumSet<org.infinispan.context.Flag> explicitFlags, java.lang.ClassLoader explicitClassLoader)
private boolean asyncSkipsThread(java.util.EnumSet<org.infinispan.context.Flag> flags, K key)
private boolean isSkipLoader(java.util.EnumSet<org.infinispan.context.Flag> flags)
public AdvancedCache<K,V> getAdvancedCache()
getAdvancedCache
in interface Cache<K,V>
public org.infinispan.remoting.rpc.RpcManager getRpcManager()
AdvancedCache
ClusteringConfiguration.cacheMode()
is CacheMode.LOCAL
, this
method will return null.getRpcManager
in interface AdvancedCache<K,V>
public AdvancedCache<K,V> withFlags(org.infinispan.context.Flag... flags)
AdvancedCache
cache.withFlags(Flag.FORCE_WRITE_LOCK).get(key);will invoke a cache.get() with a write lock forced. Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users could also consider using the
DecoratedCache
wrapper, as this allows for more readable
code. E.g.:
Cache forceWriteLockCache = new DecoratedCache(cache, Flag.FORCE_WRITE_LOCK); forceWriteLockCache.get(key1); forceWriteLockCache.get(key2); forceWriteLockCache.get(key3);
withFlags
in interface AdvancedCache<K,V>
flags
- a set of flags to apply. See the Flag
documentation.AdvancedCache
instance on which a real operation is to be invoked, if the flags are
to be applied.private Transaction getOngoingTransaction()
private java.lang.Object executeCommandAndCommitIfNeeded(org.infinispan.context.InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
private boolean isTxInjected(org.infinispan.context.InvocationContext ctx)
private void tryRollback()
public java.lang.ClassLoader getClassLoader()
AdvancedCache
DecoratedCache
wrapper.getClassLoader
in interface AdvancedCache<K,V>
public AdvancedCache<K,V> with(java.lang.ClassLoader classLoader)
AdvancedCache
AdvancedCache
operation
with a given ClassLoader
. This means that any ClassLoader
happening
as a result of the cache operation will be done using the ClassLoader
given. For example:
When users store POJO instances in caches configured with StoreAsBinaryConfiguration
,
these instances are transformed into byte arrays. When these entries are
read from the cache, a lazy unmarshalling process happens where these byte
arrays are transformed back into POJO instances. Using AdvancedCache.with(ClassLoader)
when reading that enables users to provide the class loader that should
be used when trying to locate the classes that are constructed as a result
of the unmarshalling process.
cache.with(classLoader).get(key);Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users could also consider using the
DecoratedCache
wrapper, as this allows for more readable
code. E.g.:
Cache classLoaderSpecificCache = new DecoratedCache(cache, classLoader); classLoaderSpecificCache.get(key1); classLoaderSpecificCache.get(key2); classLoaderSpecificCache.get(key3);
with
in interface AdvancedCache<K,V>
AdvancedCache
instance upon which operations can be called
with a particular ClassLoader
.public V put(K key, V value, org.infinispan.metadata.Metadata metadata)
AdvancedCache
#put(K, V)
, which takes in an instance of
Metadata
which can be used to provide metadata information for
the entry being stored, such as lifespan, version of value...etc.put
in interface AdvancedCache<K,V>
key
- key to usevalue
- value to storemetadata
- information to store alongside the valuepublic V replace(K key, V value, org.infinispan.metadata.Metadata metadata)
AdvancedCache
#replace(K, V)
, which takes in an
instance of Metadata
which can be used to provide metadata
information for the entry being stored, such as lifespan, version
of value...etc. The Metadata
is only stored if the call is
successful.replace
in interface AdvancedCache<K,V>
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keymetadata
- information to store alongside the new valuepublic boolean replace(K key, V oldValue, V value, org.infinispan.metadata.Metadata metadata)
AdvancedCache
#replace(K, V, V)
, which takes in an
instance of Metadata
which can be used to provide metadata
information for the entry being stored, such as lifespan, version
of value...etc. The Metadata
is only stored if the call is
successful.replace
in interface AdvancedCache<K,V>
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keyvalue
- value to be associated with the specified keymetadata
- information to store alongside the new valuepublic V putIfAbsent(K key, V value, org.infinispan.metadata.Metadata metadata)
AdvancedCache
#putIfAbsent(K, V)
, which takes in an
instance of Metadata
which can be used to provide metadata
information for the entry being stored, such as lifespan, version
of value...etc. The Metadata
is only stored if the call is
successful.putIfAbsent
in interface AdvancedCache<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keymetadata
- information to store alongside the new valuepublic org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value, org.infinispan.metadata.Metadata metadata)
AdvancedCache
AdvancedCache.put(Object, Object, Metadata)
which stores
metadata alongside the value. This method does not block on remote calls,
even if your cache mode is synchronous. Has no benefit over
AdvancedCache.put(Object, Object, Metadata)
if used in LOCAL mode.
putAsync
in interface AdvancedCache<K,V>
key
- key to usevalue
- value to storemetadata
- information to store alongside the new valueprivate void associateImplicitTransactionWithCurrentThread(org.infinispan.context.InvocationContext ctx) throws javax.transaction.InvalidTransactionException, SystemException
javax.transaction.InvalidTransactionException
SystemException
public java.util.Properties getConfigurationAsProperties()