public class LockControlCommand extends AbstractTransactionBoundaryCommand implements FlagAffectedCommand, TopologyAffectedCommand, TransactionalRemoteLockCommand
VisitableCommand.LoadType
Modifier and Type | Field and Description |
---|---|
static int |
COMMAND_ID |
cacheName, globalTx
Constructor and Description |
---|
LockControlCommand(ByteString cacheName) |
LockControlCommand(Collection<?> keys,
ByteString cacheName,
long flags,
GlobalTransaction gtx) |
LockControlCommand(Object key,
ByteString cacheName,
long flags,
GlobalTransaction gtx) |
Modifier and Type | Method and Description |
---|---|
Object |
acceptVisitor(InvocationContext ctx,
Visitor visitor)
Accept a visitor, and return the result of accepting this visitor.
|
RemoteTxInvocationContext |
createContext(ComponentRegistry componentRegistry)
It creates the transaction context.
|
boolean |
equals(Object o) |
byte |
getCommandId()
Used by marshallers to convert this command into an id for streaming.
|
long |
getFlagsBitSet() |
Object |
getKeyLockOwner()
It returns the lock owner of the key.
|
Collection<Object> |
getKeys() |
Collection<?> |
getKeysToLock()
It returns a
Collection with the keys to be lock. |
Object |
getSingleKey() |
int |
hashCode() |
boolean |
hasSkipLocking()
It checks if this command should acquire locks.
|
boolean |
hasZeroLockAcquisition() |
CompletionStage<?> |
invokeAsync(ComponentRegistry registry)
Invoke the command asynchronously.
|
boolean |
isUnlock() |
boolean |
multipleKeys() |
void |
readFrom(ObjectInput input)
Reads this instance from the stream written by
ReplicableCommand.writeTo(ObjectOutput) . |
void |
setFlagsBitSet(long bitSet)
Set the flags, replacing any existing flags.
|
void |
setGlobalTransaction(GlobalTransaction gtx) |
void |
setUnlock(boolean unlock) |
String |
toString() |
void |
writeTo(ObjectOutput output)
Writes this instance to the
ObjectOutput . |
getCacheName, getGlobalTransaction, getOrigin, getTopologyId, invalidRemoteTxReturnValue, isReturnValueExpected, loadType, markTransactionAsRemote, setOrigin, setTopologyId, visitRemoteTransaction
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addFlag, addFlags, addFlags, getFlags, hasAllFlags, hasAnyFlag, hasFlag, setFlags
init, loadType
getTopologyId, setTopologyId
public static final int COMMAND_ID
public LockControlCommand(ByteString cacheName)
public LockControlCommand(Collection<?> keys, ByteString cacheName, long flags, GlobalTransaction gtx)
public LockControlCommand(Object key, ByteString cacheName, long flags, GlobalTransaction gtx)
public void setGlobalTransaction(GlobalTransaction gtx)
public Collection<Object> getKeys()
public boolean multipleKeys()
public Object getSingleKey()
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
VisitableCommand
acceptVisitor
in interface VisitableCommand
ctx
- invocation contextvisitor
- visitor to acceptThrowable
- in the event of problemspublic CompletionStage<?> invokeAsync(ComponentRegistry registry) throws Throwable
CacheRpcCommand
This method replaces ReplicableCommand.invoke()
for remote execution.
The default implementation and ReplicableCommand.invoke()
will be removed in future versions.
invokeAsync
in interface CacheRpcCommand
invokeAsync
in class AbstractTransactionBoundaryCommand
Throwable
public RemoteTxInvocationContext createContext(ComponentRegistry componentRegistry)
TransactionalRemoteLockCommand
createContext
in interface TransactionalRemoteLockCommand
TxInvocationContext
.public byte getCommandId()
ReplicableCommand
getCommandId
in interface ReplicableCommand
public void writeTo(ObjectOutput output) throws IOException
ReplicableCommand
ObjectOutput
.writeTo
in interface ReplicableCommand
writeTo
in class AbstractTransactionBoundaryCommand
output
- the stream.IOException
- if an error occurred during the I/O.public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException
ReplicableCommand
ReplicableCommand.writeTo(ObjectOutput)
.readFrom
in interface ReplicableCommand
readFrom
in class AbstractTransactionBoundaryCommand
input
- the stream to read.IOException
- if an error occurred during the I/O.ClassNotFoundException
- if it tries to load an undefined class.public boolean isUnlock()
public void setUnlock(boolean unlock)
public boolean equals(Object o)
equals
in class AbstractTransactionBoundaryCommand
public int hashCode()
hashCode
in class AbstractTransactionBoundaryCommand
public String toString()
toString
in class AbstractTransactionBoundaryCommand
public long getFlagsBitSet()
getFlagsBitSet
in interface FlagAffectedCommand
FlagAffectedCommand.setFlagsBitSet(long)
, FlagAffectedCommand.addFlags(long)
and FlagAffectedCommand.addFlags(Set)
methods.public void setFlagsBitSet(long bitSet)
FlagAffectedCommand
setFlagsBitSet
in interface FlagAffectedCommand
public Collection<?> getKeysToLock()
RemoteLockCommand
Collection
with 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 and null
is not a valid return value.
getKeysToLock
in interface RemoteLockCommand
Collection
of keys to lock.public Object getKeyLockOwner()
RemoteLockCommand
Usually, in transaction caches it is the GlobalTransaction
and in
non-transactional caches the CommandInvocationId
.
getKeyLockOwner
in interface RemoteLockCommand
public boolean hasZeroLockAcquisition()
hasZeroLockAcquisition
in interface RemoteLockCommand
public boolean hasSkipLocking()
RemoteLockCommand
hasSkipLocking
in interface RemoteLockCommand
true
if locks should be acquired for the keys in RemoteLockCommand.getKeysToLock()
.Copyright © 2021 JBoss by Red Hat. All rights reserved.