Package org.infinispan.commands.write
Enum Class ValueMatcher
- All Implemented Interfaces:
Serializable,Comparable<ValueMatcher>,Constable
A policy for determining if a write command should be executed based on the current value in the cache.
When retrying conditional write commands in non-transactional caches, it is also used to determine the appropriate
return value. E.g. if a
putIfAbsent(k, v) already succeeded on a backup owner which became the primary owner,
when retrying the command will find v in the cache but should return null. For non-conditional
commands it's impossible to know what the previous value was, so the command is allowed to return v.- Since:
- 6.0
- Author:
- Dan Berindei
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAlways match.Match when the existing value is equal to the expected value.Match when the existing value is equal to the expected value or to the new value.Never match.Match any non-null value. -
Method Summary
Modifier and TypeMethodDescriptionabstract ValueMatcherabstract booleanstatic ValueMatchervalueOf(int ordinal) Returns the enum constant of this class with the specified name.static ValueMatcherReturns the enum constant of this class with the specified name.static ValueMatcher[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MATCH_ALWAYS
Always match. Used when the command is not conditional or when the value was already checked (on the primary owner, in non-tx caches, or on the originator, in tx caches). Also used when retryingBasicCache.remove(Object)operations. -
MATCH_EXPECTED
Match when the existing value is equal to the expected value. Used forConcurrentMap.putIfAbsent(Object, Object),ConcurrentMap.replace(Object, Object, Object), andConcurrentMap.remove(Object, Object). -
MATCH_EXPECTED_OR_NEW
Match when the existing value is equal to the expected value or to the new value. Used only in non-tx caches, when retrying a conditional command on the primary owner. -
MATCH_EXPECTED_OR_NULL
-
MATCH_NON_NULL
Match any non-null value. Used forConcurrentMap.replace(Object, Object)andBasicCache.remove(Object). -
MATCH_NEVER
Never match. Only used in transactional mode, as unsuccessful commands are still sent remotely, even though they should not be performed.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
matches
-
matcherForRetry
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
ordinal- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-