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, visitRemoteTransaction
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
canBlock, invoke, invokeAsync, isSuccessful, setOrigin
init
public 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 CacheRpcCommand
invokeAsync
in class AbstractTransactionBoundaryCommand
Throwable
public RemoteTxInvocationContext createContext(ComponentRegistry componentRegistry)
TransactionalRemoteLockCommand
createContext
in interface TransactionalRemoteLockCommand
TxInvocationContext
.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()
.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 Collection<?> getAffectedKeys()
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 by Red Hat. All rights reserved.