public class LockControlCommand extends AbstractTransactionBoundaryCommand implements FlagAffectedCommand, TransactionalRemoteLockCommand
Modifier and Type | Field and Description |
---|---|
static int |
COMMAND_ID |
Constructor and Description |
---|
LockControlCommand(Collection<?> keys,
String cacheName,
Set<Flag> flags,
GlobalTransaction gtx) |
LockControlCommand(Object key,
String cacheName,
Set<Flag> flags,
GlobalTransaction gtx) |
LockControlCommand(String cacheName) |
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()
It creates the transaction context.
|
boolean |
equals(Object o) |
byte |
getCommandId()
Used by marshallers to convert this command into an id for streaming.
|
Set<Flag> |
getFlags() |
Object |
getKeyLockOwner()
It returns the lock owner of the key.
|
Collection<Object> |
getKeys() |
Collection<Object> |
getKeysToLock()
It returns a
Collection with the keys to be lock. |
Metadata |
getMetadata()
Get metadata of this command.
|
Object |
getSingleKey() |
int |
hashCode() |
boolean |
hasSkipLocking()
It checks if this command should acquire locks.
|
boolean |
hasZeroLockAcquisition() |
boolean |
isUnlock() |
boolean |
multipleKeys() |
Object |
perform(InvocationContext ignored)
Performs the primary function of the command.
|
void |
readFrom(ObjectInput input)
Reads this instance from the stream written by
ReplicableCommand.writeTo(ObjectOutput) . |
void |
replaceKey(Object oldKey,
Object replacement) |
void |
replaceKeys(Map<Object,Object> replacements) |
void |
setFlags(Set<Flag> flags)
Set the flags, replacing any existing flags.
|
void |
setGlobalTransaction(GlobalTransaction gtx) |
void |
setMetadata(Metadata metadata)
Sets metadata for this command.
|
void |
setUnlock(boolean unlock) |
String |
toString() |
void |
writeTo(ObjectOutput output)
Writes this instance to the
ObjectOutput . |
canBlock, getCacheName, getGlobalTransaction, getOrigin, getRemoteTransaction, getTopologyId, ignoreCommandOnStatus, init, invalidRemoteTxReturnValue, isReturnValueExpected, markTransactionAsRemote, readsExistingValues, setOrigin, setTopologyId, shouldInvoke, visitRemoteTransaction
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
alwaysReadsExistingValues, ignoreCommandOnStatus, readsExistingValues, shouldInvoke
getTopologyId, setTopologyId
canBlock, getParameters, isReturnValueExpected, setParameters
addFlag, addFlags, hasFlag, setFlags
public static final int COMMAND_ID
public LockControlCommand(String cacheName)
public LockControlCommand(Collection<?> keys, String cacheName, Set<Flag> flags, GlobalTransaction gtx)
public LockControlCommand(Object key, String cacheName, Set<Flag> 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 Object perform(InvocationContext ignored) throws Throwable
ReplicableCommand
perform
in interface ReplicableCommand
perform
in class AbstractTransactionBoundaryCommand
ignored
- invocation contextThrowable
- in the event of problems.public RemoteTxInvocationContext createContext()
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 Set<Flag> getFlags()
getFlags
in interface LocalFlagAffectedCommand
LocalFlagAffectedCommand.setFlags(java.util.Set)
. The set should
not be modified directly, only via the LocalFlagAffectedCommand.setFlags(Set)
, LocalFlagAffectedCommand.addFlag(Flag)
and LocalFlagAffectedCommand.addFlags(Set)
methods.public void setFlags(Set<Flag> flags)
LocalFlagAffectedCommand
setFlags
in interface LocalFlagAffectedCommand
flags
- The new flags.public Metadata getMetadata()
MetadataAwareCommand
getMetadata
in interface MetadataAwareCommand
public void setMetadata(Metadata metadata)
MetadataAwareCommand
setMetadata
in interface MetadataAwareCommand
public Collection<Object> 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 © 2022 JBoss, a division of Red Hat. All rights reserved.