Package org.infinispan.commands.write
Enum ValueMatcher
- All Implemented Interfaces:
Serializable
,Comparable<ValueMatcher>
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
-
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 ValueMatcher
abstract boolean
abstract boolean
Deprecated.Since 9.0, no longer used.static ValueMatcher
valueOf
(int ordinal) Returns the enum constant of this type with the specified name.static ValueMatcher
Returns the enum constant of this type with the specified name.static ValueMatcher[]
values()
Returns an array containing the constants of this enum type, 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 type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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 nameNullPointerException
- if the argument is null
-
matches
-
nonExistentEntryCanMatch
Deprecated.Since 9.0, no longer used. -
matcherForRetry
-
valueOf
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:
ordinal
- 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 nameNullPointerException
- if the argument is null
-