Enum 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
    • Enum Constant Detail

      • ZERO_LOCK_ACQUISITION_TIMEOUT

        public static final Flag ZERO_LOCK_ACQUISITION_TIMEOUT
        Overrides the LockingConfiguration.lockAcquisitionTimeout(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. Write operations mat not acquire the entry locks. In distributed mode, the modifications performed during an operation in a non-owner node are going to L1, if it is enabled, otherwise the operation is a no-op in that node.
      • 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

        @Deprecated
        public static final Flag SKIP_CACHE_STATUS_CHECK
        Deprecated.
        This flag is no longer in use.
        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 CacheLoaders.
      • SKIP_CACHE_LOAD

        public static final Flag SKIP_CACHE_LOAD
        Skips loading an entry from any configured CacheLoaders. Useful for example to perform a BasicCache.put(Object, Object) operation while not interested in the return value (i.e. the previous value of the key).
        Note that the loader will be skipped even if that changes the meaning of the operation, e.g. for conditional or DeltaAware write operations. If that is not intended, you should use IGNORE_RETURN_VALUES instead.
      • 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.

        When using this flag with Optimistic caches, lock acquisition happen in the prepare phase at which point this flag will be ignored in order to ensure that Infinispan reports the correct exception back to the transaction manager. This is done for safety reasons to avoid inconsistent cache contents.

      • 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 Map.get(Object) or Map.containsKey(Object), or to return the overwritten value for BasicCache.put(Object, Object) or BasicCache.remove(Object). This would render return values for most operations unusable, in exchange for the performance gains of reducing remote calls.
        Note that the remote lookup will be skipped even if that changes the meaning of the operation, e.g. for conditional or DeltaAware write operations. If that is not intended, you should use IGNORE_RETURN_VALUES instead.
      • 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_STATE_TRANSFER

        public static final Flag PUT_FOR_STATE_TRANSFER
        Flags the invocation as a put operation done internally by the state transfer. This flag was created purely for internal Infinispan usage, and should not be used by clients calling into Infinispan. Note for internal users: PUT_FOR_STATE_TRANSFER only applies to state transfer-specific actions, in order to avoid loading the previous value one should add the IGNORE_RETURN_VALUES flag explicitly.
      • PUT_FOR_X_SITE_STATE_TRANSFER

        public static final Flag PUT_FOR_X_SITE_STATE_TRANSFER
        Flags the invocation as a put operation done internally by the cross-site state transfer. This flag was created purely for internal Infinispan usage, and should not be used by clients calling into Infinispan.
      • 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

        @Deprecated
        public static final Flag REMOVE_DATA_ON_STOP
        Deprecated.
        No longer in use.
        This flag has only effect when it's used before calling Cache.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
        Ignore current consistent hash and read from data container/commit the change no matter what (if the flag is set).
      • DELTA_WRITE

        @Deprecated
        public static final Flag DELTA_WRITE
        Deprecated.
        since 9.1
        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.
      • IGNORE_RETURN_VALUES

        public static final Flag IGNORE_RETURN_VALUES
        Signals that a write operation's return value will be ignored, so reading the existing value from a store or from a remote node is not necessary. Typical operations whose return value might be ignored include Map.put(Object, Object) whose return value indicates previous value. So, a user might decide to the put something in the cache but might not be interested in the return value. This flag is ignored for operations that need the existing value to execute correctly, e.g. Map.get(Object), conditional remove (ConcurrentMap.remove(Object, Object)), and replace with an expected value (ConcurrentMap.replace(Object, Object, Object)). That means it is safe to use IGNORE_RETURN_VALUES for all the operations on a cache, unlike SKIP_REMOTE_LOOKUP and SKIP_CACHE_LOAD.
      • SKIP_XSITE_BACKUP

        public static final Flag SKIP_XSITE_BACKUP
        If cross-site replication is enabled, this would skip the replication to any remote site.
      • GUARANTEED_DELIVERY

        public static final Flag GUARANTEED_DELIVERY
        Using a synchronous cache (whether replicated or distributed) provides the cache caller guarantees that data has been sent to other cluster nodes correctly and has been applied successfully. At the network level, message delivery acknowledgement protocols are used to provide these guarantees. In order to increase performance and achieve better throughput, it's common to use negative acknowledgment protocols to confirm the delivery of messages. The problem with these protocols is that if the last message is lost, it can be difficult to recover it because a new message would need to be sent to find the gap. Some cache use cases might involve storing an entry in a synchronously replicated or distributed cache, and if that store operation fails, the application fails to start. One such example is the Infinispan Hot Rod server. When it starts, the first thing it does is add its endpoint information to a cache which is used to notify clients of topology changes. If this operation fails, the server cannot start because topologies won't include this node, and no more cache operations are attempted. So, in exceptional use cases such as this, a cluster wide cache update should be positively acknowledged by the other nodes, so that if the data is lost, it can be retransmitted immediately without the need to wait for an extra cluster wide operation to detect the lost message. The way to force a particular cache operation to be positively acknowledged is to send this flag. Note that this is flag is EXPERIMENTAL and so there is a high probability that it will be removed in future Infinispan versions.
      • SKIP_LISTENER_NOTIFICATION

        public static final Flag SKIP_LISTENER_NOTIFICATION
        This flag skips listener notifications as a result of a cache operation. For example, if this flag is passed as a result of a Map.get(Object) call, no callbacks will be made on listeners annotated with CacheEntryVisited.
      • SKIP_STATISTICS

        public static final Flag SKIP_STATISTICS
        This flag skips statistics updates as a result of a cache operation. For example, if this flag is passed as a result of a Map.get(Object) call, no cache hits or cache miss counters will be updated.
      • OPERATION_HOTROD

        public static final Flag OPERATION_HOTROD
        Flag to identify cache operations coming from the Hot Rod server.
      • OPERATION_MEMCACHED

        public static final Flag OPERATION_MEMCACHED
        Flag to identify cache operations coming from the Memcached server.
      • SKIP_INDEX_CLEANUP

        public static final Flag SKIP_INDEX_CLEANUP
        Any time a new indexed entry is inserted, a delete statement is issued on the indexes to remove previous values. This delete statement is executed even if there is no known entry having the same key. Enable this flag when you know for sure there is no existing entry in the index for improved performance. For example, this is useful for speeding up import of new data in an empty cache having an empty index.
      • COMMAND_RETRY

        public static final Flag COMMAND_RETRY
        If a write operation encounters a retry due to a topology change this flag should be used to tell the new owner that such a thing happened. This flag was created purely for internal Infinispan usage, and should not be used by clients calling into Infinispan.
      • ROLLING_UPGRADE

        public static final Flag ROLLING_UPGRADE
        Flag to identity that data is being written as part of a Rolling Upgrade.
      • REMOTE_ITERATION

        public static final Flag REMOTE_ITERATION
        Flag to identify that this iteration is done on a remote node and thus no additional wrappings are required
      • SKIP_SIZE_OPTIMIZATION

        public static final Flag SKIP_SIZE_OPTIMIZATION
        Flag that can be used to skip any size optimizations - forcing iteration of entries to count. User shouldn't normally need to use this flag. This is helpful if there are concerns that can cause just a simple size invocation from being consistent (eg. on-going transaction with modifications).
    • 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
      • copyWithoutRemotableFlags

        @Deprecated
        public static long copyWithoutRemotableFlags​(long flagsBitSet)
        Deprecated.
        Since 9.0
        Creates a copy of a Flag BitSet removing instances of FAIL_SILENTLY.
      • copyWithoutRemotableFlags

        @Deprecated
        public static Set<Flag> copyWithoutRemotableFlags​(Set<Flag> flags)
        Deprecated.
        Since 9.0
        Creates a copy of a Flag set removing instances of FAIL_SILENTLY.