org.infinispan.context
Enum Flag

java.lang.Object
  extended by java.lang.Enum<Flag>
      extended by org.infinispan.context.Flag
All Implemented Interfaces:
Serializable, Comparable<Flag>

public enum Flag
extends Enum<Flag>

Available flags, which may be set on a per-invocation basis. These are provided using the AdvancedCache interface, using some of the overloaded methods that allow passing in of a variable number of Flags.

When making modifications to these enum, do not change the order of enumerations, so always append any new enumerations after the last one. Finally, enumerations should not be removed.

Since:
4.0
Author:
Manik Surtani, Galder ZamarreƱo

Nested Class Summary
static class Flag.Externalizer
           
 
Enum Constant Summary
CACHE_MODE_LOCAL
          Forces LOCAL mode operation, even if the cache is configured to use a clustered mode like replication, invalidation or distribution.
DELTA_WRITE
          Signals when a particular cache write operation is writing a delta of the object, rather than the full object.
FAIL_SILENTLY
          Swallows any exceptions, logging them instead at a low log level.
FORCE_ASYNCHRONOUS
          Forces asynchronous network calls where possible, even if otherwise configured to use synchronous network calls.
FORCE_SYNCHRONOUS
          Forces synchronous network calls where possible, even if otherwise configured to use asynchronous network calls.
FORCE_WRITE_LOCK
          Forces a write lock, even if the invocation is a read operation.
PUT_FOR_EXTERNAL_READ
          Flags the invocation as a Cache.putForExternalRead(Object, Object) call, as opposed to a regular Map.put(Object, Object).
REMOVE_DATA_ON_STOP
          This flag has only effect when it's used before calling Lifecycle.stop() and its effect is that apart from stopping the cache, it removes all of its content from both memory and any backing cache store.
SKIP_CACHE_LOAD
          Skips loading an entry from any configured CacheStores.
SKIP_CACHE_STATUS_CHECK
          Skips checking whether a cache is in a receptive state, i.e.
SKIP_CACHE_STORE
          Skips storing an entry to any configured CacheStores.
SKIP_INDEXING
          Used by the Query module only, it will prevent the indexes to be updated as a result of the current operations.
SKIP_LOCKING
          Bypasses lock acquisition for this invocation altogether.
SKIP_OWNERSHIP_CHECK
          Used by the DistLockingInterceptor to commit the change no matter what (if the flag is set).
SKIP_REMOTE_LOOKUP
          When used with distributed cache mode, will prevent retrieving a remote value either when executing a get() or exists(), or to provide an overwritten return value for a put() or remove().
SKIP_SHARED_CACHE_STORE
          If this flag is enabled, if a cache store is shared, then storage to the store is skipped.
ZERO_LOCK_ACQUISITION_TIMEOUT
          Overrides the Configuration.setLockAcquisitionTimeout(long) configuration setting by ensuring lock managers use a 0-millisecond lock acquisition timeout.
 
Method Summary
protected static Set<Flag> copyWithouthRemotableFlags(Set<Flag> flags)
          Creates a copy of a Flag Set removing instances of FAIL_SILENTLY.
static Flag valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Flag[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ZERO_LOCK_ACQUISITION_TIMEOUT

public static final Flag ZERO_LOCK_ACQUISITION_TIMEOUT
Overrides the Configuration.setLockAcquisitionTimeout(long) configuration setting by ensuring lock managers use a 0-millisecond lock acquisition timeout. Useful if you only want to acquire a lock on an entry if and only if the lock is uncontended.


CACHE_MODE_LOCAL

public static final Flag CACHE_MODE_LOCAL
Forces LOCAL mode operation, even if the cache is configured to use a clustered mode like replication, invalidation or distribution. Applying this flag will suppress any RPC messages otherwise associated with this invocation.


SKIP_LOCKING

public static final Flag SKIP_LOCKING
Bypasses lock acquisition for this invocation altogether. A potentially dangerous flag, as it can lead to inconsistent data: a Lock is needed to make sure the same value is written to each node replica; a lock is also needed to guarantee that several writes on the same key are not applied out of order to an async CacheLoader storage engine. So this flag is useful only as an optimization when the same key is written once and never again, or as an unsafe optimisation if the period between writes on the same key is large enough to make a race condition never happen in practice. If this is unclear, avoid it.


FORCE_WRITE_LOCK

public static final Flag FORCE_WRITE_LOCK
Forces a write lock, even if the invocation is a read operation. Useful when reading an entry to later update it within the same transaction, and is analogous in behavior and use case to a select ... for update ... SQL statement.


SKIP_CACHE_STATUS_CHECK

public static final Flag SKIP_CACHE_STATUS_CHECK
Skips checking whether a cache is in a receptive state, i.e. is ComponentStatus.RUNNING. May break operation in weird ways!


FORCE_ASYNCHRONOUS

public static final Flag FORCE_ASYNCHRONOUS
Forces asynchronous network calls where possible, even if otherwise configured to use synchronous network calls. Only applicable to non-local, clustered caches.


FORCE_SYNCHRONOUS

public static final Flag FORCE_SYNCHRONOUS
Forces synchronous network calls where possible, even if otherwise configured to use asynchronous network calls. Only applicable to non-local, clustered caches.


SKIP_CACHE_STORE

public static final Flag SKIP_CACHE_STORE
Skips storing an entry to any configured CacheStores.


SKIP_CACHE_LOAD

public static final Flag SKIP_CACHE_LOAD
Skips loading an entry from any configured CacheStores. Useful for example to perform a put() operation while not interested in the return value of put() which would return the eventually existing previous value.
Note that if you want to ignore the return value of put() and you are in distributed mode you should also use the SKIP_REMOTE_LOOKUP flag.


FAIL_SILENTLY

public static final Flag FAIL_SILENTLY

Swallows any exceptions, logging them instead at a low log level. Will prevent a failing operation from affecting any ongoing JTA transactions as well.

This Flag will not be replicated to remote nodes, but it will still protect the invoker from remote exceptions.


SKIP_REMOTE_LOOKUP

public static final Flag SKIP_REMOTE_LOOKUP
When used with distributed cache mode, will prevent retrieving a remote value either when executing a get() or exists(), or to provide an overwritten return value for a put() or remove(). This would render return values for some operations (such as Map.put(Object, Object) or Map.remove(Object) unusable, in exchange for the performance gains of reducing remote calls.
Note that if you want to ignore the return value of put() and you have configured a cache store you should also use the SKIP_CACHE_LOAD flag.


SKIP_INDEXING

public static final Flag SKIP_INDEXING
Used by the Query module only, it will prevent the indexes to be updated as a result of the current operations.


PUT_FOR_EXTERNAL_READ

public static final Flag PUT_FOR_EXTERNAL_READ
Flags the invocation as a Cache.putForExternalRead(Object, Object) call, as opposed to a regular Map.put(Object, Object).


SKIP_SHARED_CACHE_STORE

public static final Flag SKIP_SHARED_CACHE_STORE
If this flag is enabled, if a cache store is shared, then storage to the store is skipped.


REMOVE_DATA_ON_STOP

public static final Flag REMOVE_DATA_ON_STOP
This flag has only effect when it's used before calling Lifecycle.stop() and its effect is that apart from stopping the cache, it removes all of its content from both memory and any backing cache store.


SKIP_OWNERSHIP_CHECK

public static final Flag SKIP_OWNERSHIP_CHECK
Used by the DistLockingInterceptor to commit the change no matter what (if the flag is set). This is used when a node A pushes state to another node B and A doesn't want B to check if the state really belongs to it


DELTA_WRITE

public static final Flag DELTA_WRITE
Signals when a particular cache write operation is writing a delta of the object, rather than the full object. This can be useful in order to make decisions such as whether the cache store needs checking to see if the previous value needs to be loaded and merged.

Method Detail

values

public static Flag[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Flag c : Flag.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Flag valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

copyWithouthRemotableFlags

protected static Set<Flag> copyWithouthRemotableFlags(Set<Flag> flags)
Creates a copy of a Flag Set removing instances of FAIL_SILENTLY. The copy might be the same instance if no change is required, and should be considered immutable.

Parameters:
flags -
Returns:
might return the same instance

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.