Package org.infinispan.commands.tx
Class AbstractTransactionBoundaryCommand
java.lang.Object
org.infinispan.commands.tx.AbstractTransactionBoundaryCommand
- All Implemented Interfaces:
CacheRpcCommand,ReplicableCommand,TopologyAffectedCommand,TracedCommand,TransactionBoundaryCommand,VisitableCommand
- Direct Known Subclasses:
CommitCommand,LockControlCommand,PrepareCommand,RollbackCommand
public abstract class AbstractTransactionBoundaryCommand
extends Object
implements TransactionBoundaryCommand
An abstract transaction boundary command that holds a reference to a
GlobalTransaction- Since:
- 4.0
- Author:
- Manik Surtani (manik@jboss.org), Mircea.Markus@jboss.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.commands.VisitableCommand
VisitableCommand.LoadType -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the origin of the commandintinthashCode()protected ObjectThis is what is returned to remote callers when an invalid RemoteTransaction is encountered.invokeAsync(ComponentRegistry registry) Invoke the command asynchronously.booleanIf true, a return value will be provided when performed remotely.loadType()voidmarkTransactionAsRemote(boolean isRemote) voidreadFrom(ObjectInput input) Reads this instance from the stream written byReplicableCommand.writeTo(ObjectOutput).voidSets the sender'sAddress.voidsetTopologyId(int topologyId) toString()protected voidvoidwriteTo(ObjectOutput output) Writes this instance to theObjectOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.commands.ReplicableCommand
canBlock, getCommandId, invoke, invokeAsync, isSuccessful, logThrowableMethods inherited from interface org.infinispan.commands.TracedCommand
getOperationName, getSpanAttributes, setSpanAttributesMethods inherited from interface org.infinispan.commands.VisitableCommand
acceptVisitor, init
-
Field Details
-
globalTx
-
cacheName
-
-
Constructor Details
-
AbstractTransactionBoundaryCommand
-
-
Method Details
-
getTopologyId
public int getTopologyId()- Specified by:
getTopologyIdin interfaceTopologyAffectedCommand
-
setTopologyId
public void setTopologyId(int topologyId) - Specified by:
setTopologyIdin interfaceTopologyAffectedCommand
-
getCacheName
- Specified by:
getCacheNamein interfaceCacheRpcCommand- Returns:
- the name of the cache that produced this command. This will also be the name of the cache this command is intended for.
-
getGlobalTransaction
- Specified by:
getGlobalTransactionin interfaceTransactionBoundaryCommand
-
markTransactionAsRemote
public void markTransactionAsRemote(boolean isRemote) - Specified by:
markTransactionAsRemotein interfaceTransactionBoundaryCommand
-
invalidRemoteTxReturnValue
This is what is returned to remote callers when an invalid RemoteTransaction is encountered. Can happen if a remote node propagates a transactional call to the current node, and the current node has no idea of the transaction in question. Can happen during rehashing, when ownerships are reassigned during a transactions. Returning a null usually means the transactional command succeeded.- Returns:
- return value to respond to a remote caller with if the transaction context is invalid.
-
invokeAsync
Description copied from interface:CacheRpcCommandInvoke the command asynchronously.This method replaces
ReplicableCommand.invoke()for remote execution. The default implementation andReplicableCommand.invoke()will be removed in future versions.- Specified by:
invokeAsyncin interfaceCacheRpcCommand- Throws:
Throwable
-
visitRemoteTransaction
-
writeTo
Description copied from interface:ReplicableCommandWrites this instance to theObjectOutput.- Specified by:
writeToin interfaceReplicableCommand- Parameters:
output- the stream.- Throws:
IOException- if an error occurred during the I/O.
-
readFrom
Description copied from interface:ReplicableCommandReads this instance from the stream written byReplicableCommand.writeTo(ObjectOutput).- Specified by:
readFromin interfaceReplicableCommand- Parameters:
input- the stream to read.- Throws:
IOException- if an error occurred during the I/O.ClassNotFoundException- if it tries to load an undefined class.
-
loadType
- Specified by:
loadTypein interfaceVisitableCommand- Returns:
- Nodes on which the command needs to read the previous values of the keys it acts on.
-
equals
-
hashCode
public int hashCode() -
toString
-
getOrigin
Description copied from interface:CacheRpcCommandGet the origin of the command- Specified by:
getOriginin interfaceCacheRpcCommand
-
setOrigin
Description copied from interface:ReplicableCommandSets the sender'sAddress.By default, it doesn't set anything. Implement this method if the sender's
Addressis needed.- Specified by:
setOriginin interfaceCacheRpcCommand- Specified by:
setOriginin interfaceReplicableCommand- Parameters:
origin- the sender'sAddress
-
isReturnValueExpected
public boolean isReturnValueExpected()Description copied from interface:ReplicableCommandIf true, a return value will be provided when performed remotely. Otherwise, a remoteResponseGeneratormay choose to simply return null to save on marshalling costs.- Specified by:
isReturnValueExpectedin interfaceReplicableCommand- Returns:
- true or false
-