Package org.infinispan.transaction.impl
Class TotalOrderRemoteTransactionState
- java.lang.Object
-
- org.infinispan.transaction.impl.TotalOrderRemoteTransactionState
-
public class TotalOrderRemoteTransactionState extends Object
Represents a state for a Remote Transaction when the Total Order based protocol is used.- Since:
- 5.3
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description TotalOrderRemoteTransactionState(GlobalTransaction globalTransaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllSynchronizedBlocks(Collection<TotalOrderLatch> blocks)
void
addKeysLockedForClear()
void
addLockedKey(Object key)
void
addSynchronizedBlock(TotalOrderLatch block)
void
awaitUntilReset()
boolean
equals(Object o)
Collection<TotalOrderLatch>
getConflictingTransactionBlocks()
GlobalTransaction
getGlobalTransaction()
Collection<Object>
getLockedKeys()
TotalOrderLatch
getTransactionSynchronizedBlock()
int
hashCode()
boolean
isCommitReceived()
check if the transaction is marked for commit (by the Commit Command)boolean
isFinished()
boolean
isRollbackReceived()
check if the transaction is marked for rollback (by the Rollback Command)void
prepared()
mark the transaction as prepared (the validation was finished) and notify a possible pending commit or rollback commandvoid
preparing()
mark the transaction as preparing, blocking the commit and rollback commands until theprepared()
is invokedvoid
reset()
void
setTransactionSynchronizedBlock(TotalOrderLatch block)
Sets theTotalOrderLatch
to be associated to this transactionString
toString()
boolean
waitUntilPrepared(boolean commit)
Commit and rollback commands invokes this method and they are blocked here if the state is PREPARING
-
-
-
Constructor Detail
-
TotalOrderRemoteTransactionState
public TotalOrderRemoteTransactionState(GlobalTransaction globalTransaction)
-
-
Method Detail
-
isRollbackReceived
public boolean isRollbackReceived()
check if the transaction is marked for rollback (by the Rollback Command)- Returns:
- true if it is marked for rollback, false otherwise
-
isCommitReceived
public boolean isCommitReceived()
check if the transaction is marked for commit (by the Commit Command)- Returns:
- true if it is marked for commit, false otherwise
-
prepared
public void prepared()
mark the transaction as prepared (the validation was finished) and notify a possible pending commit or rollback command
-
preparing
public void preparing()
mark the transaction as preparing, blocking the commit and rollback commands until theprepared()
is invoked
-
waitUntilPrepared
public final boolean waitUntilPrepared(boolean commit) throws InterruptedException
Commit and rollback commands invokes this method and they are blocked here if the state is PREPARING- Parameters:
commit
- true if it is a commit command, false otherwise- Returns:
- true if the command needs to be processed, false otherwise
- Throws:
InterruptedException
- when it is interrupted while waiting
-
isFinished
public final boolean isFinished()
- Returns:
- true if the transaction has received the prepare and the commit or rollback
-
getLockedKeys
public final Collection<Object> getLockedKeys()
- Returns:
- the keys locked in
org.infinispan.transaction.totalorder.TotalOrderManager
-
getTransactionSynchronizedBlock
public final TotalOrderLatch getTransactionSynchronizedBlock()
- Returns:
- the
TotalOrderLatch
associated to this transaction
-
setTransactionSynchronizedBlock
public final void setTransactionSynchronizedBlock(TotalOrderLatch block)
Sets theTotalOrderLatch
to be associated to this transaction
-
getGlobalTransaction
public final GlobalTransaction getGlobalTransaction()
- Returns:
- the global transaction
-
awaitUntilReset
public final void awaitUntilReset() throws InterruptedException
- Throws:
InterruptedException
-
reset
public final void reset()
-
addSynchronizedBlock
public final void addSynchronizedBlock(TotalOrderLatch block)
-
addAllSynchronizedBlocks
public final void addAllSynchronizedBlocks(Collection<TotalOrderLatch> blocks)
-
addKeysLockedForClear
public final void addKeysLockedForClear()
-
addLockedKey
public final void addLockedKey(Object key)
-
getConflictingTransactionBlocks
public Collection<TotalOrderLatch> getConflictingTransactionBlocks()
-
-