Package org.infinispan.commands.write
Class AbstractDataWriteCommand
java.lang.Object
org.infinispan.commands.read.AbstractDataCommand
org.infinispan.commands.write.AbstractDataWriteCommand
- All Implemented Interfaces:
DataCommand
,FlagAffectedCommand
,ReplicableCommand
,SegmentSpecificCommand
,TopologyAffectedCommand
,VisitableCommand
,DataWriteCommand
,WriteCommand
,RemoteLockCommand
- Direct Known Subclasses:
AbstractWriteKeyCommand
,ComputeCommand
,ComputeIfAbsentCommand
,IracPutKeyValueCommand
,PutKeyValueCommand
,RemoveCommand
,ReplaceCommand
public abstract class AbstractDataWriteCommand
extends AbstractDataCommand
implements DataWriteCommand, RemoteLockCommand
Stuff common to WriteCommands
- Since:
- 4.0
- Author:
- Manik Surtani
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.commands.VisitableCommand
VisitableCommand.LoadType
-
Field Summary
FieldsFields inherited from class org.infinispan.commands.read.AbstractDataCommand
key, segment
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
AbstractDataWriteCommand
(Object key, int segment, long flagsBitSet, CommandInvocationId commandInvocationId) -
Method Summary
Modifier and TypeMethodDescriptionCollection<?>
final Object
It returns the lock owner of the key.Collection<?>
It returns aCollection
with the keys to be lock.final boolean
It checks if this command should acquire locks.final boolean
boolean
If true, a return value will be provided when performed remotely.Methods inherited from class org.infinispan.commands.read.AbstractDataCommand
equals, getFlagsBitSet, getKey, getSegment, getTopologyId, hashCode, printFlags, setFlagsBitSet, setKey, setTopologyId, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.infinispan.commands.DataCommand
getKey
Methods inherited from interface org.infinispan.commands.write.DataWriteCommand
getInternalMetadata, getInternalMetadata, setInternalMetadata, setInternalMetadata
Methods inherited from interface org.infinispan.commands.FlagAffectedCommand
addFlag, addFlags, addFlags, getFlags, getFlagsBitSet, hasAllFlags, hasAnyFlag, hasFlag, setFlags, setFlagsBitSet
Methods inherited from interface org.infinispan.commands.ReplicableCommand
canBlock, getCommandId, invoke, invokeAsync, logThrowable, readFrom, setOrigin, writeTo
Methods inherited from interface org.infinispan.commands.SegmentSpecificCommand
getSegment
Methods inherited from interface org.infinispan.commands.TopologyAffectedCommand
getTopologyId, setTopologyId
Methods inherited from interface org.infinispan.commands.VisitableCommand
acceptVisitor, init, loadType
Methods inherited from interface org.infinispan.commands.write.WriteCommand
fail, getValueMatcher, isConditional, isSuccessful, isWriteOnly, setValueMatcher, updateStatusFromRemoteResponse
-
Field Details
-
commandInvocationId
-
-
Constructor Details
-
AbstractDataWriteCommand
protected AbstractDataWriteCommand() -
AbstractDataWriteCommand
protected AbstractDataWriteCommand(Object key, int segment, long flagsBitSet, CommandInvocationId commandInvocationId)
-
-
Method Details
-
getAffectedKeys
- Specified by:
getAffectedKeys
in interfaceWriteCommand
- Returns:
- a collection of keys affected by this write command. Some commands - such as ClearCommand - may return an empty collection for this method.
-
isReturnValueExpected
public boolean isReturnValueExpected()Description copied from interface:ReplicableCommand
If true, a return value will be provided when performed remotely. Otherwise, a remoteResponseGenerator
may choose to simply return null to save on marshalling costs.- Specified by:
isReturnValueExpected
in interfaceReplicableCommand
- Overrides:
isReturnValueExpected
in classAbstractDataCommand
- Returns:
- true or false
-
getKeysToLock
Description copied from interface:RemoteLockCommand
It returns aCollection
with the keys to be lock.It may return an empty collection if no keys needs to be locked independently of the return value of
RemoteLockCommand.hasSkipLocking()
. It may contains duplicated keys andnull
is not a valid return value.- Specified by:
getKeysToLock
in interfaceRemoteLockCommand
- Returns:
- a
Collection
of keys to lock.
-
getKeyLockOwner
Description copied from interface:RemoteLockCommand
It returns the lock owner of the key.Usually, in transaction caches it is the
GlobalTransaction
and in non-transactional caches theCommandInvocationId
.- Specified by:
getKeyLockOwner
in interfaceRemoteLockCommand
- Returns:
- the lock owner of the key.
-
hasZeroLockAcquisition
public final boolean hasZeroLockAcquisition()- Specified by:
hasZeroLockAcquisition
in interfaceRemoteLockCommand
- Returns:
- it the locks should be acquire with 0 (zero) acquisition timeout.
-
hasSkipLocking
public final boolean hasSkipLocking()Description copied from interface:RemoteLockCommand
It checks if this command should acquire locks.- Specified by:
hasSkipLocking
in interfaceRemoteLockCommand
- Returns:
true
if locks should be acquired for the keys inRemoteLockCommand.getKeysToLock()
.
-
getCommandInvocationId
- Specified by:
getCommandInvocationId
in interfaceWriteCommand
- Returns:
- the
CommandInvocationId
associated to the command.
-