Class LockControlCommand
java.lang.Object
org.infinispan.commands.tx.AbstractTransactionBoundaryCommand
org.infinispan.commands.control.LockControlCommand
- All Implemented Interfaces:
FlagAffectedCommand, CacheRpcCommand, ReplicableCommand, TopologyAffectedCommand, TracedCommand, TransactionBoundaryCommand, VisitableCommand, VersionAware, RemoteLockCommand, TransactionalRemoteLockCommand
@ProtoTypeId(1118)
public class LockControlCommand
extends AbstractTransactionBoundaryCommand
implements FlagAffectedCommand, TopologyAffectedCommand, TransactionalRemoteLockCommand
LockControlCommand is a command that enables distributed locking across infinispan nodes.
For more details refer to: https://jira.jboss.org/jira/browse/ISPN-70 https://jira.jboss.org/jira/browse/ISPN-48
- Since:
- 4.0
- Author:
- Vladimir Blagojevic (vblagoje@redhat.com), Mircea.Markus@jboss.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface VisitableCommand
VisitableCommand.LoadType -
Field Summary
Fields inherited from class AbstractTransactionBoundaryCommand
cacheName, globalTx -
Constructor Summary
ConstructorsConstructorDescriptionLockControlCommand(Object key, ByteString cacheName, long flags, GlobalTransaction globalTx) LockControlCommand(Collection<?> keys, ByteString cacheName, long flags, GlobalTransaction globalTx) -
Method Summary
Modifier and TypeMethodDescriptionacceptVisitor(InvocationContext ctx, Visitor visitor) Accept a visitor, and return the result of accepting this visitor.createContext(ComponentRegistry componentRegistry) It creates the transaction context.booleanlongIt returns the lock owner of the key.getKeys()Collection<?> It returns aCollectionwith the keys to be lock.inthashCode()booleanIt checks if this command should acquire locks.booleaninvokeAsync(ComponentRegistry registry) Invoke the command asynchronously.booleanisUnlock()booleanvoidsetFlagsBitSet(long bitSet) Set the flags, replacing any existing flags.voidvoidsetUnlock(boolean unlock) Returns aNodeVersionrepresenting the Infinispan version in which this command was added.toString()Methods inherited from class AbstractTransactionBoundaryCommand
getCacheName, getGlobalTransaction, getOrigin, getTopologyId, invalidRemoteTxReturnValue, isReturnValueExpected, loadType, markTransactionAsRemote, setOrigin, setTopologyId, visitRemoteTransactionMethods inherited from interface CacheRpcCommand
getCacheName, getOrigin, setOriginMethods inherited from interface FlagAffectedCommand
addFlags, getFlags, hasAllFlags, hasAnyFlagMethods inherited from interface ReplicableCommand
getCommandId, isReturnValueExpected, isSuccessful, logThrowable, readFrom, writeToMethods inherited from interface TopologyAffectedCommand
getTopologyId, setTopologyIdMethods inherited from interface TracedCommand
getOperationName, getSpanAttributes, setSpanAttributesMethods inherited from interface VisitableCommand
init, loadType
-
Constructor Details
-
LockControlCommand
public LockControlCommand(Collection<?> keys, ByteString cacheName, long flags, GlobalTransaction globalTx) -
LockControlCommand
-
-
Method Details
-
isUnlock
@ProtoField(5) public boolean isUnlock() -
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.
-
setGlobalTransaction
-
getKeys
-
multipleKeys
public boolean multipleKeys() -
getSingleKey
-
acceptVisitor
Description copied from interface:VisitableCommandAccept a visitor, and return the result of accepting this visitor.- Specified by:
acceptVisitorin interfaceVisitableCommand- Parameters:
ctx- invocation contextvisitor- visitor to accept- Returns:
- arbitrary return value
- Throws:
Throwable- in the event of problems
-
invokeAsync
Description copied from interface:CacheRpcCommandInvoke the command asynchronously.- Specified by:
invokeAsyncin interfaceCacheRpcCommand- Specified by:
invokeAsyncin interfaceVisitableCommand- Overrides:
invokeAsyncin classAbstractTransactionBoundaryCommand- Throws:
Throwable
-
createContext
Description copied from interface:TransactionalRemoteLockCommandIt creates the transaction context.- Specified by:
createContextin interfaceTransactionalRemoteLockCommand- Returns:
- the
TxInvocationContext.
-
setUnlock
public void setUnlock(boolean unlock) -
equals
- Overrides:
equalsin classAbstractTransactionBoundaryCommand
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractTransactionBoundaryCommand
-
supportedSince
Description copied from interface:ReplicableCommandReturns aNodeVersionrepresenting the Infinispan version in which this command was added. This value is used to ensure that when the cluster contains different Infinispan versions, only commands compatible with the oldest version are transmitted.Abstract classes should not implement this method as the version should be specific to an individual implementation. Similarly, implementations which extend another
ReplicableCommandshould always override this method.- Specified by:
supportedSincein interfaceReplicableCommand- Specified by:
supportedSincein interfaceVersionAware- Returns:
- a
NodeVersioncorresponding to the Infinispan version this command was added.
-
toString
- Overrides:
toStringin classAbstractTransactionBoundaryCommand
-
setFlagsBitSet
public void setFlagsBitSet(long bitSet) Description copied from interface:FlagAffectedCommandSet the flags, replacing any existing flags.- Specified by:
setFlagsBitSetin interfaceFlagAffectedCommand
-
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
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 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().
-