org.infinispan.statetransfer
Class StateTransferLockImpl
java.lang.Object
org.infinispan.statetransfer.StateTransferLockImpl
- All Implemented Interfaces:
- StateTransferLock
public class StateTransferLockImpl
- extends Object
- implements StateTransferLock
This class implements a specialized lock that allows the state transfer process (which is not a single thread)
to block new write commands for the duration of the state transfer.
At the same time the block call will not return until any running write commands have finished executing.
Write commands in a transaction scope don't actually write anything, so they are ignored. Lock commands on
the other hand, both explicit and implicit, are considered as write commands for the purpose of this lock.
Commit commands, rollback commands and unlock commands are special in that letting them proceed may speed up other
running commands, so they are allowed to proceed as long as there are any running write commands. Commit is also
a write command, so the block call will wait until all commit commands have finished.
- Since:
- 5.1
- Author:
- Manik Surtani, Dan Berindei <dan@infinispan.org>
Method Summary |
boolean |
acquireForCommand(InvocationContext ctx,
WriteCommand command)
|
boolean |
acquireForCommand(TxInvocationContext ctx,
CommitCommand command)
|
boolean |
acquireForCommand(TxInvocationContext ctx,
LockControlCommand command)
|
boolean |
acquireForCommand(TxInvocationContext ctx,
PrepareCommand command)
|
boolean |
acquireForCommand(TxInvocationContext ctx,
RollbackCommand command)
|
boolean |
areNewTransactionsBlocked()
|
void |
blockNewTransactions(int cacheViewId)
|
void |
blockNewTransactionsAsync()
|
int |
getBlockingCacheViewId()
|
void |
injectDependencies(Configuration config)
|
void |
releaseForCommand(InvocationContext ctx,
WriteCommand command)
|
void |
releaseForCommand(TxInvocationContext ctx,
CommitCommand command)
|
void |
releaseForCommand(TxInvocationContext ctx,
LockControlCommand command)
|
void |
releaseForCommand(TxInvocationContext ctx,
PrepareCommand command)
|
void |
releaseForCommand(TxInvocationContext ctx,
RollbackCommand command)
|
String |
toString()
|
void |
unblockNewTransactions(int cacheViewId)
|
void |
waitForStateTransferToEnd(InvocationContext ctx,
VisitableCommand command,
int newCacheViewId)
Release the state lock temporarily in order to allow a pending state transfer to start. |
StateTransferLockImpl
public StateTransferLockImpl()
injectDependencies
public void injectDependencies(Configuration config)
releaseForCommand
public void releaseForCommand(InvocationContext ctx,
WriteCommand command)
- Specified by:
releaseForCommand
in interface StateTransferLock
releaseForCommand
public void releaseForCommand(TxInvocationContext ctx,
PrepareCommand command)
- Specified by:
releaseForCommand
in interface StateTransferLock
releaseForCommand
public void releaseForCommand(TxInvocationContext ctx,
CommitCommand command)
- Specified by:
releaseForCommand
in interface StateTransferLock
releaseForCommand
public void releaseForCommand(TxInvocationContext ctx,
RollbackCommand command)
- Specified by:
releaseForCommand
in interface StateTransferLock
releaseForCommand
public void releaseForCommand(TxInvocationContext ctx,
LockControlCommand command)
- Specified by:
releaseForCommand
in interface StateTransferLock
acquireForCommand
public boolean acquireForCommand(InvocationContext ctx,
WriteCommand command)
throws InterruptedException,
TimeoutException
- Specified by:
acquireForCommand
in interface StateTransferLock
- Throws:
InterruptedException
TimeoutException
acquireForCommand
public boolean acquireForCommand(TxInvocationContext ctx,
PrepareCommand command)
throws InterruptedException,
TimeoutException
- Specified by:
acquireForCommand
in interface StateTransferLock
- Throws:
InterruptedException
TimeoutException
acquireForCommand
public boolean acquireForCommand(TxInvocationContext ctx,
CommitCommand command)
throws InterruptedException,
TimeoutException
- Specified by:
acquireForCommand
in interface StateTransferLock
- Throws:
InterruptedException
TimeoutException
acquireForCommand
public boolean acquireForCommand(TxInvocationContext ctx,
RollbackCommand command)
throws InterruptedException,
TimeoutException
- Specified by:
acquireForCommand
in interface StateTransferLock
- Throws:
InterruptedException
TimeoutException
acquireForCommand
public boolean acquireForCommand(TxInvocationContext ctx,
LockControlCommand command)
throws TimeoutException,
InterruptedException
- Specified by:
acquireForCommand
in interface StateTransferLock
- Throws:
TimeoutException
InterruptedException
waitForStateTransferToEnd
public void waitForStateTransferToEnd(InvocationContext ctx,
VisitableCommand command,
int newCacheViewId)
throws TimeoutException,
InterruptedException
- Description copied from interface:
StateTransferLock
- Release the state lock temporarily in order to allow a pending state transfer to start.
It doesn't have any effect if there is no pending state transfer.
- Specified by:
waitForStateTransferToEnd
in interface StateTransferLock
- Throws:
TimeoutException
InterruptedException
blockNewTransactions
public void blockNewTransactions(int cacheViewId)
throws InterruptedException
- Specified by:
blockNewTransactions
in interface StateTransferLock
- Throws:
InterruptedException
blockNewTransactionsAsync
public void blockNewTransactionsAsync()
- Specified by:
blockNewTransactionsAsync
in interface StateTransferLock
unblockNewTransactions
public void unblockNewTransactions(int cacheViewId)
- Specified by:
unblockNewTransactions
in interface StateTransferLock
areNewTransactionsBlocked
public boolean areNewTransactionsBlocked()
- Specified by:
areNewTransactionsBlocked
in interface StateTransferLock
getBlockingCacheViewId
public int getBlockingCacheViewId()
- Specified by:
getBlockingCacheViewId
in interface StateTransferLock
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.