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
ConstructorsModifierConstructorDescriptionprotected
protected
AbstractWriteManyCommand
(CommandInvocationId commandInvocationId, Params params, DataConversion keyDataConversion, DataConversion valueDataConversion) protected
AbstractWriteManyCommand
(AbstractWriteManyCommand<K, V> command) -
Method Summary
Modifier and TypeMethodDescriptionvoid
fail()
Make subsequent invocations ofWriteCommand.isSuccessful()
returnfalse
.long
It returns the lock owner of the key.int
boolean
It checks if this command should acquire locks.boolean
void
init
(ComponentRegistry componentRegistry) boolean
Certain commands only work based on a certain condition or state of the cache.boolean
boolean
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
setInternalMetadata
(Object key, PrivateMetadata internalMetadata) void
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, hasAllFlags, 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
canBlock, getCommandId, invoke, invokeAsync, isReturnValueExpected, logThrowable, readFrom, setOrigin, writeTo
Methods inherited from interface org.infinispan.commands.VisitableCommand
acceptVisitor, loadType
Methods inherited from interface org.infinispan.commands.write.WriteCommand
getAffectedKeys, isWriteOnly, updateStatusFromRemoteResponse
-
Constructor Details
-
AbstractWriteManyCommand
protected AbstractWriteManyCommand(CommandInvocationId commandInvocationId, Params params, DataConversion keyDataConversion, DataConversion valueDataConversion) -
AbstractWriteManyCommand
-
AbstractWriteManyCommand
protected AbstractWriteManyCommand()
-
-
Method Details
-
init
- Specified by:
init
in interfaceVisitableCommand
-
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
- Specified by:
getValueMatcher
in interfaceWriteCommand
- Returns:
- The current value matching policy.
-
setValueMatcher
- 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
-
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
- Specified by:
getParams
in interfaceFunctionalCommand<K,
V>
-
setParams
-
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
- 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
- Specified by:
getKeyDataConversion
in interfaceFunctionalCommand<K,
V>
-
getValueDataConversion
- Specified by:
getValueDataConversion
in interfaceFunctionalCommand<K,
V>
-
getInternalMetadata
- Specified by:
getInternalMetadata
in interfaceWriteCommand
-
setInternalMetadata
- Specified by:
setInternalMetadata
in interfaceWriteCommand
-