public class PrepareCommand extends AbstractTransactionBoundaryCommand implements TransactionalRemoteLockCommand
VisitableCommand.LoadType| Modifier and Type | Field and Description |
|---|---|
static byte |
COMMAND_ID |
protected WriteCommand[] |
modifications |
protected boolean |
onePhaseCommit |
protected boolean |
retriedCommand |
cacheName, globalTx| Constructor and Description |
|---|
PrepareCommand(ByteString cacheName) |
PrepareCommand(ByteString cacheName,
GlobalTransaction gtx,
boolean onePhaseCommit,
WriteCommand... modifications) |
PrepareCommand(ByteString 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(ComponentRegistry componentRegistry)
It creates the transaction context.
|
Collection<?> |
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<?> |
getKeysToLock()
It returns a
Collection with the keys to be lock. |
WriteCommand[] |
getModifications() |
boolean |
hasModifications() |
boolean |
hasSkipLocking()
It checks if this command should acquire locks.
|
boolean |
hasZeroLockAcquisition() |
CompletionStage<?> |
invokeAsync(ComponentRegistry registry)
Invoke the command asynchronously.
|
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.
|
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. |
equals, getCacheName, getGlobalTransaction, getOrigin, getTopologyId, hashCode, invalidRemoteTxReturnValue, loadType, markTransactionAsRemote, setOrigin, setTopologyId, visitRemoteTransactionclone, finalize, getClass, notify, notifyAll, wait, wait, waitcanBlock, invoke, invokeAsync, isSuccessful, setOrigininitpublic static final byte COMMAND_ID
protected WriteCommand[] modifications
protected boolean onePhaseCommit
protected boolean retriedCommand
public PrepareCommand(ByteString cacheName, GlobalTransaction gtx, boolean onePhaseCommit, WriteCommand... modifications)
public PrepareCommand(ByteString cacheName, GlobalTransaction gtx, List<WriteCommand> commands, boolean onePhaseCommit)
public PrepareCommand(ByteString cacheName)
public 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 CacheRpcCommandinvokeAsync in class AbstractTransactionBoundaryCommandThrowablepublic RemoteTxInvocationContext createContext(ComponentRegistry componentRegistry)
TransactionalRemoteLockCommandcreateContext in interface TransactionalRemoteLockCommandTxInvocationContext.public Collection<?> 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().public 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 Collection<?> getAffectedKeys()
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 © 2022 JBoss by Red Hat. All rights reserved.