Class AbstractWriteManyCommand<K,V>
- java.lang.Object
-
- org.infinispan.commands.functional.AbstractWriteManyCommand<K,V>
-
- All Implemented Interfaces:
FlagAffectedCommand
,FunctionalCommand<K,V>
,ReplicableCommand
,TopologyAffectedCommand
,VisitableCommand
,WriteCommand
,RemoteLockCommand
- Direct Known Subclasses:
ReadWriteManyCommand
,ReadWriteManyEntriesCommand
,WriteOnlyManyCommand
,WriteOnlyManyEntriesCommand
public abstract class AbstractWriteManyCommand<K,V> extends Object implements WriteCommand, FunctionalCommand<K,V>, RemoteLockCommand
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.commands.VisitableCommand
VisitableCommand.LoadType
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractWriteManyCommand()
protected
AbstractWriteManyCommand(CommandInvocationId commandInvocationId, Params params, DataConversion keyDataConversion, DataConversion valueDataConversion)
protected
AbstractWriteManyCommand(AbstractWriteManyCommand<K,V> command)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canBlock()
If true, the command is processed asynchronously in a thread provided by an Infinispan thread pool.void
fail()
Make subsequent invocations ofWriteCommand.isSuccessful()
returnfalse
.CommandInvocationId
getCommandInvocationId()
long
getFlagsBitSet()
DataConversion
getKeyDataConversion()
Object
getKeyLockOwner()
It returns the lock owner of the key.Params
getParams()
int
getTopologyId()
DataConversion
getValueDataConversion()
ValueMatcher
getValueMatcher()
boolean
hasSkipLocking()
It checks if this command should acquire locks.boolean
hasZeroLockAcquisition()
abstract void
init(ComponentRegistry componentRegistry)
boolean
isConditional()
Certain commands only work based on a certain condition or state of the cache.boolean
isForwarded()
boolean
isSuccessful()
Some commands may want to provide information on whether the command was successful or not.void
setFlagsBitSet(long bitSet)
Set the flags, replacing any existing flags.void
setForwarded(boolean forwarded)
void
setParams(Params params)
void
setTopologyId(int topologyId)
void
setValueMatcher(ValueMatcher valueMatcher)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.commands.FlagAffectedCommand
addFlag, addFlags, addFlags, getFlags, hasAnyFlag, hasFlag, setFlags
-
Methods inherited from interface org.infinispan.commands.functional.FunctionalCommand
toMutation
-
Methods inherited from interface org.infinispan.util.concurrent.locks.RemoteLockCommand
getKeysToLock
-
Methods inherited from interface org.infinispan.commands.ReplicableCommand
getCommandId, invoke, invokeAsync, isReturnValueExpected, readFrom, setOrigin, writeTo
-
Methods inherited from interface org.infinispan.commands.VisitableCommand
acceptVisitor, ignoreCommandOnStatus, loadType, perform, shouldInvoke
-
Methods inherited from interface org.infinispan.commands.write.WriteCommand
getAffectedKeys, isWriteOnly, updateStatusFromRemoteResponse
-
-
-
-
Constructor Detail
-
AbstractWriteManyCommand
protected AbstractWriteManyCommand(CommandInvocationId commandInvocationId, Params params, DataConversion keyDataConversion, DataConversion valueDataConversion)
-
AbstractWriteManyCommand
protected AbstractWriteManyCommand(AbstractWriteManyCommand<K,V> command)
-
AbstractWriteManyCommand
protected AbstractWriteManyCommand()
-
-
Method Detail
-
getTopologyId
public int getTopologyId()
- Specified by:
getTopologyId
in interfaceTopologyAffectedCommand
-
setTopologyId
public void setTopologyId(int topologyId)
- Specified by:
setTopologyId
in interfaceTopologyAffectedCommand
-
isForwarded
public boolean isForwarded()
-
setForwarded
public void setForwarded(boolean forwarded)
-
getValueMatcher
public ValueMatcher getValueMatcher()
- Specified by:
getValueMatcher
in interfaceWriteCommand
- Returns:
- The current value matching policy.
-
setValueMatcher
public void setValueMatcher(ValueMatcher valueMatcher)
- Specified by:
setValueMatcher
in interfaceWriteCommand
- Parameters:
valueMatcher
- The new value matching policy.
-
isSuccessful
public boolean isSuccessful()
Description copied from interface:WriteCommand
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
- Specified by:
isSuccessful
in interfaceWriteCommand
- Returns:
- true if the command completed successfully, false otherwise.
-
isConditional
public boolean isConditional()
Description copied from interface:WriteCommand
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.- Specified by:
isConditional
in interfaceWriteCommand
- Returns:
- true if the command is conditional, false otherwise
-
canBlock
public boolean canBlock()
Description copied from interface:ReplicableCommand
If true, the command is processed asynchronously in a thread provided by an Infinispan thread pool. Otherwise, the command is processed directly in the JGroups thread. This feature allows to avoid keep a JGroups thread busy that can originate discard of messages and retransmissions. So, the commands that can block (waiting for some state, acquiring locks, etc.) should return true.- Specified by:
canBlock
in interfaceReplicableCommand
- Returns:
true
if the command can block/wait,false
otherwise
-
fail
public void fail()
Description copied from interface:WriteCommand
Make subsequent invocations ofWriteCommand.isSuccessful()
returnfalse
.- Specified by:
fail
in interfaceWriteCommand
-
getFlagsBitSet
public long getFlagsBitSet()
- Specified by:
getFlagsBitSet
in interfaceFlagAffectedCommand
- Returns:
- The command flags. Flags can be modified with
FlagAffectedCommand.setFlagsBitSet(long)
,FlagAffectedCommand.addFlags(long)
andFlagAffectedCommand.addFlags(Set)
methods.
-
setFlagsBitSet
public void setFlagsBitSet(long bitSet)
Description copied from interface:FlagAffectedCommand
Set the flags, replacing any existing flags.- Specified by:
setFlagsBitSet
in interfaceFlagAffectedCommand
-
getParams
public Params getParams()
- Specified by:
getParams
in interfaceFunctionalCommand<K,V>
-
setParams
public void setParams(Params params)
-
getKeyLockOwner
public Object 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.
-
getCommandInvocationId
public CommandInvocationId getCommandInvocationId()
- Specified by:
getCommandInvocationId
in interfaceWriteCommand
- Returns:
- the
CommandInvocationId
associated to the command.
-
hasZeroLockAcquisition
public boolean hasZeroLockAcquisition()
- Specified by:
hasZeroLockAcquisition
in interfaceRemoteLockCommand
- Returns:
- it the locks should be acquire with 0 (zero) acquisition timeout.
-
hasSkipLocking
public 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()
.
-
getKeyDataConversion
public DataConversion getKeyDataConversion()
- Specified by:
getKeyDataConversion
in interfaceFunctionalCommand<K,V>
-
getValueDataConversion
public DataConversion getValueDataConversion()
- Specified by:
getValueDataConversion
in interfaceFunctionalCommand<K,V>
-
init
public abstract void init(ComponentRegistry componentRegistry)
-
-