Package org.infinispan.commands.write
Interface WriteCommand
-
- All Superinterfaces:
FlagAffectedCommand
,ReplicableCommand
,TopologyAffectedCommand
,VisitableCommand
- All Known Subinterfaces:
DataWriteCommand
- All Known Implementing Classes:
AbstractDataWriteCommand
,AbstractWriteKeyCommand
,AbstractWriteManyCommand
,ApplyDeltaCommand
,ClearCommand
,ComputeCommand
,ComputeIfAbsentCommand
,EvictCommand
,InvalidateCommand
,InvalidateL1Command
,PutKeyValueCommand
,PutMapCommand
,ReadWriteKeyCommand
,ReadWriteKeyValueCommand
,ReadWriteManyCommand
,ReadWriteManyEntriesCommand
,RemoveCommand
,RemoveExpiredCommand
,ReplaceCommand
,WriteOnlyKeyCommand
,WriteOnlyKeyValueCommand
,WriteOnlyManyCommand
,WriteOnlyManyEntriesCommand
public interface WriteCommand extends VisitableCommand, FlagAffectedCommand, TopologyAffectedCommand
A command that modifies the cache in some way- Since:
- 4.0
- Author:
- Manik Surtani
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.commands.VisitableCommand
VisitableCommand.LoadType
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
fail()
Make subsequent invocations ofisSuccessful()
returnfalse
.Collection<?>
getAffectedKeys()
CommandInvocationId
getCommandInvocationId()
ValueMatcher
getValueMatcher()
boolean
isConditional()
Certain commands only work based on a certain condition or state of the cache.boolean
isSuccessful()
Some commands may want to provide information on whether the command was successful or not.default boolean
isWriteOnly()
Indicates whether the command is write-only, meaning that it makes no attempt to read the previously associated value with key for which the command is directed.void
setValueMatcher(ValueMatcher valueMatcher)
default void
updateStatusFromRemoteResponse(Object remoteResponse)
Deprecated.since 9.1-
Methods inherited from interface org.infinispan.commands.FlagAffectedCommand
addFlag, addFlags, addFlags, getFlags, getFlagsBitSet, hasAnyFlag, hasFlag, setFlags, setFlagsBitSet
-
Methods inherited from interface org.infinispan.commands.ReplicableCommand
canBlock, getCommandId, invoke, invokeAsync, isReturnValueExpected, readFrom, setOrigin, writeTo
-
Methods inherited from interface org.infinispan.commands.TopologyAffectedCommand
getTopologyId, setTopologyId
-
Methods inherited from interface org.infinispan.commands.VisitableCommand
acceptVisitor, ignoreCommandOnStatus, loadType, perform, shouldInvoke
-
-
-
-
Method Detail
-
isSuccessful
boolean isSuccessful()
Some commands may want to provide information on whether the command was successful or not. This is different from a failure, which usually would result in an exception being thrown. An example is a putIfAbsent() not doing anything because the key in question was present. This would result in a isSuccessful() call returning false.- Specified by:
isSuccessful
in interfaceReplicableCommand
- Returns:
- true if the command completed successfully, false otherwise.
-
isConditional
boolean isConditional()
Certain commands only work based on a certain condition or state of the cache. For example,ConcurrentMap.putIfAbsent(Object, Object)
only does anything if a condition is met, i.e., the entry in question is not already present. This method tests whether the command in question is conditional or not.- Returns:
- true if the command is conditional, false otherwise
-
getValueMatcher
ValueMatcher getValueMatcher()
- Returns:
- The current value matching policy.
-
setValueMatcher
void setValueMatcher(ValueMatcher valueMatcher)
- Parameters:
valueMatcher
- The new value matching policy.
-
getAffectedKeys
Collection<?> getAffectedKeys()
- Returns:
- a collection of keys affected by this write command. Some commands - such as ClearCommand - may return an empty collection for this method.
-
updateStatusFromRemoteResponse
@Deprecated default void updateStatusFromRemoteResponse(Object remoteResponse)
Deprecated.since 9.1Used for conditional commands, to update the status of the command on the originator based on the result of its execution on the primary owner.
-
fail
void fail()
Make subsequent invocations ofisSuccessful()
returnfalse
.
-
isWriteOnly
default boolean isWriteOnly()
Indicates whether the command is write-only, meaning that it makes no attempt to read the previously associated value with key for which the command is directed.- Returns:
- true is the command is write only, false otherwise.
-
getCommandInvocationId
CommandInvocationId getCommandInvocationId()
- Returns:
- the
CommandInvocationId
associated to the command.
-
-