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, visitRemoteTransactionclone, finalize, getClass, notify, notifyAll, wait, wait, waitalwaysReadsExistingValuesgetParameters, setParameterspublic 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
ReplicableCommandperform in interface ReplicableCommandperform in class AbstractTransactionBoundaryCommandignored - invocation contextThrowable - in the event of problems.public RemoteTxInvocationContext createContext()
TransactionalRemoteLockCommandcreateContext in interface TransactionalRemoteLockCommandTxInvocationContext.public Collection<Object> getKeysToLock()
RemoteLockCommandCollection 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 RemoteLockCommandCollection 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 RemoteLockCommandpublic boolean hasZeroLockAcquisition()
hasZeroLockAcquisition in interface RemoteLockCommandpublic boolean hasSkipLocking()
RemoteLockCommandhasSkipLocking in interface RemoteLockCommandtrue if locks should be acquired for the keys in RemoteLockCommand.getKeysToLock().protected RemoteTransaction getRemoteTransaction()
getRemoteTransaction in class AbstractTransactionBoundaryCommandpublic Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
VisitableCommandacceptVisitor in interface VisitableCommandctx - invocation contextvisitor - visitor to acceptThrowable - in the event of problemspublic WriteCommand[] getModifications()
public boolean isOnePhaseCommit()
public byte getCommandId()
ReplicableCommandgetCommandId in interface ReplicableCommandpublic void writeTo(ObjectOutput output) throws IOException
ReplicableCommandObjectOutput.writeTo in interface ReplicableCommandwriteTo in class AbstractTransactionBoundaryCommandoutput - the stream.IOException - if an error occurred during the I/O.public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException
ReplicableCommandReplicableCommand.writeTo(ObjectOutput).readFrom in interface ReplicableCommandreadFrom in class AbstractTransactionBoundaryCommandinput - 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 AbstractTransactionBoundaryCommandpublic boolean hasModifications()
public boolean isReplayEntryWrapping()
public void setReplayEntryWrapping(boolean replayEntryWrapping)
isReplayEntryWrapping()public boolean isReturnValueExpected()
ReplicableCommandResponseGenerator
may choose to simply return null to save on marshalling costs.isReturnValueExpected in interface ReplicableCommandisReturnValueExpected in class AbstractTransactionBoundaryCommandpublic boolean isRetriedCommand()
public void setRetriedCommand(boolean retriedCommand)
Copyright © 2025 JBoss, a division of Red Hat. All rights reserved.