public class PrepareCommand extends AbstractTransactionBoundaryCommand implements TransactionalRemoteLockCommand
Modifier and Type | Field and Description |
---|---|
static byte |
COMMAND_ID |
protected WriteCommand[] |
modifications |
protected CacheNotifier |
notifier |
protected boolean |
onePhaseCommit |
protected RecoveryManager |
recoveryManager |
protected boolean |
retriedCommand |
Constructor and Description |
---|
PrepareCommand(String cacheName) |
PrepareCommand(String cacheName,
GlobalTransaction gtx,
boolean onePhaseCommit,
WriteCommand... modifications) |
PrepareCommand(String cacheName,
GlobalTransaction gtx,
List<WriteCommand> commands,
boolean onePhaseCommit) |
Modifier and Type | Method and Description |
---|---|
Object |
acceptVisitor(InvocationContext ctx,
Visitor visitor)
Accept a visitor, and return the result of accepting this visitor.
|
PrepareCommand |
copy() |
RemoteTxInvocationContext |
createContext()
It creates the transaction context.
|
Set<Object> |
getAffectedKeys() |
byte |
getCommandId()
Used by marshallers to convert this command into an id for streaming.
|
Object |
getKeyLockOwner()
It returns the lock owner of the key.
|
Collection<Object> |
getKeysToLock()
It returns a
Collection with the keys to be lock. |
WriteCommand[] |
getModifications() |
protected RemoteTransaction |
getRemoteTransaction() |
boolean |
hasModifications() |
boolean |
hasSkipLocking()
It checks if this command should acquire locks.
|
boolean |
hasZeroLockAcquisition() |
void |
initialize(CacheNotifier notifier,
RecoveryManager recoveryManager) |
boolean |
isOnePhaseCommit() |
boolean |
isReplayEntryWrapping()
If set to true, then the keys touched by this transaction are to be wrapped again and original ones discarded.
|
boolean |
isRetriedCommand() |
boolean |
isReturnValueExpected()
If true, a return value will be provided when performed remotely.
|
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 |
setReplayEntryWrapping(boolean replayEntryWrapping) |
void |
setRetriedCommand(boolean retriedCommand) |
String |
toString() |
void |
writeTo(ObjectOutput output)
Writes this instance to the
ObjectOutput . |
canBlock, equals, getCacheName, getGlobalTransaction, getOrigin, getTopologyId, hashCode, ignoreCommandOnStatus, init, invalidRemoteTxReturnValue, markTransactionAsRemote, readsExistingValues, setOrigin, setTopologyId, shouldInvoke, visitRemoteTransaction
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
alwaysReadsExistingValues
getParameters, setParameters
public static final byte COMMAND_ID
protected WriteCommand[] modifications
protected boolean onePhaseCommit
protected CacheNotifier notifier
protected RecoveryManager recoveryManager
protected boolean retriedCommand
public PrepareCommand(String cacheName, GlobalTransaction gtx, boolean onePhaseCommit, WriteCommand... modifications)
public PrepareCommand(String cacheName, GlobalTransaction gtx, List<WriteCommand> commands, boolean onePhaseCommit)
public PrepareCommand(String cacheName)
public void initialize(CacheNotifier notifier, RecoveryManager recoveryManager)
public 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 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()
.protected RemoteTransaction getRemoteTransaction()
getRemoteTransaction
in class AbstractTransactionBoundaryCommand
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 WriteCommand[] getModifications()
public boolean isOnePhaseCommit()
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 PrepareCommand copy()
public String toString()
toString
in class AbstractTransactionBoundaryCommand
public boolean hasModifications()
public boolean isReplayEntryWrapping()
public void setReplayEntryWrapping(boolean replayEntryWrapping)
isReplayEntryWrapping()
public boolean isReturnValueExpected()
ReplicableCommand
ResponseGenerator
may choose to simply return null to save on marshalling costs.isReturnValueExpected
in interface ReplicableCommand
isReturnValueExpected
in class AbstractTransactionBoundaryCommand
public boolean isRetriedCommand()
public void setRetriedCommand(boolean retriedCommand)
Copyright © 2021 JBoss, a division of Red Hat. All rights reserved.