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,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
Fields Modifier and Type Field Description protected CommandInvocationIdcommandInvocationId-
Fields inherited from class org.infinispan.commands.read.AbstractDataCommand
key, segment
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDataWriteCommand()protectedAbstractDataWriteCommand(Object key, int segment, long flagsBitSet, CommandInvocationId commandInvocationId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<?>getAffectedKeys()CommandInvocationIdgetCommandInvocationId()ObjectgetKeyLockOwner()It returns the lock owner of the key.Collection<?>getKeysToLock()It returns aCollectionwith the keys to be lock.booleanhasSkipLocking()It checks if this command should acquire locks.booleanhasZeroLockAcquisition()booleanisReturnValueExpected()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, 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 Detail
-
commandInvocationId
protected CommandInvocationId commandInvocationId
-
-
Constructor Detail
-
AbstractDataWriteCommand
protected AbstractDataWriteCommand()
-
AbstractDataWriteCommand
protected AbstractDataWriteCommand(Object key, int segment, long flagsBitSet, CommandInvocationId commandInvocationId)
-
-
Method Detail
-
getAffectedKeys
public Collection<?> getAffectedKeys()
- Specified by:
getAffectedKeysin 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:ReplicableCommandIf true, a return value will be provided when performed remotely. Otherwise, a remoteResponseGeneratormay choose to simply return null to save on marshalling costs.- Specified by:
isReturnValueExpectedin interfaceReplicableCommand- Overrides:
isReturnValueExpectedin classAbstractDataCommand- Returns:
- true or false
-
getKeysToLock
public Collection<?> getKeysToLock()
Description copied from interface:RemoteLockCommandIt returns aCollectionwith 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 andnullis not a valid return value.- Specified by:
getKeysToLockin interfaceRemoteLockCommand- Returns:
- a
Collectionof keys to lock.
-
getKeyLockOwner
public final Object getKeyLockOwner()
Description copied from interface:RemoteLockCommandIt returns the lock owner of the key.Usually, in transaction caches it is the
GlobalTransactionand in non-transactional caches theCommandInvocationId.- Specified by:
getKeyLockOwnerin interfaceRemoteLockCommand- Returns:
- the lock owner of the key.
-
hasZeroLockAcquisition
public final boolean hasZeroLockAcquisition()
- Specified by:
hasZeroLockAcquisitionin interfaceRemoteLockCommand- Returns:
- it the locks should be acquire with 0 (zero) acquisition timeout.
-
hasSkipLocking
public final boolean hasSkipLocking()
Description copied from interface:RemoteLockCommandIt checks if this command should acquire locks.- Specified by:
hasSkipLockingin interfaceRemoteLockCommand- Returns:
trueif locks should be acquired for the keys inRemoteLockCommand.getKeysToLock().
-
getCommandInvocationId
public CommandInvocationId getCommandInvocationId()
- Specified by:
getCommandInvocationIdin interfaceWriteCommand- Returns:
- the
CommandInvocationIdassociated to the command.
-
-