Class AbstractWriteManyCommand<K,V>
java.lang.Object
org.infinispan.commands.functional.AbstractWriteManyCommand<K,V>
- All Implemented Interfaces:
FlagAffectedCommand, FunctionalCommand<K,V>, CacheRpcCommand, ReplicableCommand, TopologyAffectedCommand, TracedCommand, VisitableCommand, WriteCommand, VersionAware, RemoteLockCommand
- Direct Known Subclasses:
ReadWriteManyCommand, ReadWriteManyEntriesCommand, WriteOnlyManyCommand, WriteOnlyManyEntriesCommand
public abstract class AbstractWriteManyCommand<K,V>
extends Object
implements CacheRpcCommand, WriteCommand, FunctionalCommand<K,V>, RemoteLockCommand
-
Nested Class Summary
Nested classes/interfaces inherited from interface VisitableCommand
VisitableCommand.LoadType -
Field Summary
Fields inherited from interface VisitableCommand
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractWriteManyCommand(ByteString cacheName, CommandInvocationId commandInvocationId, boolean forwarded, int topologyId, Params params, long flags, DataConversion keyDataConversion, DataConversion valueDataConversion, MarshallableMap<Object, PrivateMetadata> internalMetadataMap) protectedAbstractWriteManyCommand(ByteString cacheName, CommandInvocationId commandInvocationId, Params params, DataConversion keyDataConversion, DataConversion valueDataConversion) -
Method Summary
Modifier and TypeMethodDescriptionvoidfail()Make subsequent invocations ofWriteCommand.isSuccessful()returnfalse.longIt returns the lock owner of the key.Get the origin of the commandintbooleanIt checks if this command should acquire locks.booleanvoidinit(ComponentRegistry componentRegistry) booleanCertain commands only work based on a certain condition or state of the cache.booleanbooleanIf true, a return value will be provided when performed remotely.booleanIf true, a return value will be marshalled as aSuccessfulResponse, otherwise it will be marshalled as aUnsuccessfulResponse.voidsetFlagsBitSet(long bitSet) Set the flags, replacing any existing flags.voidsetForwarded(boolean forwarded) voidsetInternalMetadata(Object key, PrivateMetadata internalMetadata) voidSet the origin of the commandvoidvoidsetTopologyId(int topologyId) voidsetValueMatcher(ValueMatcher valueMatcher) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FlagAffectedCommand
addFlags, getFlags, hasAllFlags, hasAnyFlagMethods inherited from interface FunctionalCommand
toMutationMethods inherited from interface RemoteLockCommand
getKeysToLockMethods inherited from interface ReplicableCommand
getCommandId, logThrowable, readFrom, supportedSince, writeToMethods inherited from interface TracedCommand
getOperationName, getSpanAttributes, setSpanAttributesMethods inherited from interface VisitableCommand
acceptVisitor, invokeAsync, loadTypeMethods inherited from interface WriteCommand
getAffectedKeys, isWriteOnly, shouldReplicate
-
Constructor Details
-
AbstractWriteManyCommand
protected AbstractWriteManyCommand(ByteString cacheName, CommandInvocationId commandInvocationId, boolean forwarded, int topologyId, Params params, long flags, DataConversion keyDataConversion, DataConversion valueDataConversion, MarshallableMap<Object, PrivateMetadata> internalMetadataMap) -
AbstractWriteManyCommand
protected AbstractWriteManyCommand(ByteString cacheName, CommandInvocationId commandInvocationId, Params params, DataConversion keyDataConversion, DataConversion valueDataConversion) -
AbstractWriteManyCommand
-
-
Method Details
-
init
- Specified by:
initin interfaceVisitableCommand
-
getCacheName
- Specified by:
getCacheNamein interfaceCacheRpcCommand- Returns:
- the name of the cache that produced this command. This will also be the name of the cache this command is intended for.
-
getOrigin
Description copied from interface:CacheRpcCommandGet the origin of the command- Specified by:
getOriginin interfaceCacheRpcCommand
-
setOrigin
Description copied from interface:CacheRpcCommandSet the origin of the command- Specified by:
setOriginin interfaceCacheRpcCommand- Specified by:
setOriginin interfaceReplicableCommand- Parameters:
origin- the sender'sAddress
-
getTopologyId
public int getTopologyId()- Specified by:
getTopologyIdin interfaceTopologyAffectedCommand
-
setTopologyId
public void setTopologyId(int topologyId) - Specified by:
setTopologyIdin interfaceTopologyAffectedCommand
-
isForwarded
public boolean isForwarded() -
setForwarded
public void setForwarded(boolean forwarded) -
getValueMatcher
- Specified by:
getValueMatcherin interfaceWriteCommand- Returns:
- The current value matching policy.
-
setValueMatcher
- Specified by:
setValueMatcherin interfaceWriteCommand- Parameters:
valueMatcher- The new value matching policy.
-
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- Returns:
- true or false
-
isSuccessful
public boolean isSuccessful()Description copied from interface:ReplicableCommandIf true, a return value will be marshalled as aSuccessfulResponse, otherwise it will be marshalled as aUnsuccessfulResponse.- Specified by:
isSuccessfulin interfaceReplicableCommand- Specified by:
isSuccessfulin interfaceWriteCommand- Returns:
- true if the command completed successfully, false otherwise.
-
isConditional
public boolean isConditional()Description copied from interface:WriteCommandCertain 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:
isConditionalin interfaceWriteCommand- Returns:
- true if the command is conditional, false otherwise
-
fail
public void fail()Description copied from interface:WriteCommandMake subsequent invocations ofWriteCommand.isSuccessful()returnfalse.- Specified by:
failin interfaceWriteCommand
-
getFlagsBitSet
public long getFlagsBitSet()- Specified by:
getFlagsBitSetin interfaceFlagAffectedCommand- Returns:
- The command flags. Flags can be modified with
FlagAffectedCommand.setFlagsBitSet(long),FlagAffectedCommand.addFlags(long)andFlagAffectedCommand.addFlags(long)methods.
-
setFlagsBitSet
public void setFlagsBitSet(long bitSet) Description copied from interface:FlagAffectedCommandSet the flags, replacing any existing flags.- Specified by:
setFlagsBitSetin interfaceFlagAffectedCommand
-
getParams
- Specified by:
getParamsin interfaceFunctionalCommand<K,V>
-
setParams
-
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.
-
getCommandInvocationId
- Specified by:
getCommandInvocationIdin interfaceWriteCommand- Returns:
- the
CommandInvocationIdassociated to the command.
-
hasZeroLockAcquisition
public boolean hasZeroLockAcquisition()- Specified by:
hasZeroLockAcquisitionin interfaceRemoteLockCommand- Returns:
- it the locks should be acquire with 0 (zero) acquisition timeout.
-
hasSkipLocking
public 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().
-
getKeyDataConversion
- Specified by:
getKeyDataConversionin interfaceFunctionalCommand<K,V>
-
getValueDataConversion
- Specified by:
getValueDataConversionin interfaceFunctionalCommand<K,V>
-
getInternalMetadata
- Specified by:
getInternalMetadatain interfaceWriteCommand
-
setInternalMetadata
- Specified by:
setInternalMetadatain interfaceWriteCommand
-