org.infinispan.statetransfer
Interface StateTransferLock

All Known Implementing Classes:
StateTransferLockImpl

public interface StateTransferLock

Typically adding a command, the following pattern would be used:

if (stateTransferLock.acquireForCommand()) { try { // execute this command! } finally { stateTransferLock.releaseForCommand(cmd); } }

Since:
5.1
Author:
Dan Berindei <dan@infinispan.org>

Field Summary
static int NO_BLOCKING_CACHE_VIEW
           
 
Method Summary
 boolean acquireForCommand(InvocationContext ctx, WriteCommand command)
           
 boolean acquireForCommand(TxInvocationContext ctx, CommitCommand command)
           
 boolean acquireForCommand(TxInvocationContext ctx, LockControlCommand cmd)
           
 boolean acquireForCommand(TxInvocationContext ctx, PrepareCommand command)
           
 boolean acquireForCommand(TxInvocationContext ctx, RollbackCommand command)
           
 boolean areNewTransactionsBlocked()
           
 void blockNewTransactions(int cacheViewId)
           
 void blockNewTransactionsAsync()
           
 int getBlockingCacheViewId()
           
 void releaseForCommand(InvocationContext ctx, WriteCommand command)
           
 void releaseForCommand(TxInvocationContext ctx, CommitCommand command)
           
 void releaseForCommand(TxInvocationContext ctx, LockControlCommand cmd)
           
 void releaseForCommand(TxInvocationContext ctx, PrepareCommand command)
           
 void releaseForCommand(TxInvocationContext ctx, RollbackCommand command)
           
 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.
 

Field Detail

NO_BLOCKING_CACHE_VIEW

static final int NO_BLOCKING_CACHE_VIEW
See Also:
Constant Field Values
Method Detail

acquireForCommand

boolean acquireForCommand(InvocationContext ctx,
                          WriteCommand command)
                          throws InterruptedException,
                                 TimeoutException
Throws:
InterruptedException
TimeoutException

acquireForCommand

boolean acquireForCommand(TxInvocationContext ctx,
                          PrepareCommand command)
                          throws InterruptedException,
                                 TimeoutException
Throws:
InterruptedException
TimeoutException

acquireForCommand

boolean acquireForCommand(TxInvocationContext ctx,
                          CommitCommand command)
                          throws InterruptedException,
                                 TimeoutException
Throws:
InterruptedException
TimeoutException

acquireForCommand

boolean acquireForCommand(TxInvocationContext ctx,
                          RollbackCommand command)
                          throws InterruptedException,
                                 TimeoutException
Throws:
InterruptedException
TimeoutException

acquireForCommand

boolean acquireForCommand(TxInvocationContext ctx,
                          LockControlCommand cmd)
                          throws TimeoutException,
                                 InterruptedException
Throws:
TimeoutException
InterruptedException

releaseForCommand

void releaseForCommand(InvocationContext ctx,
                       WriteCommand command)

releaseForCommand

void releaseForCommand(TxInvocationContext ctx,
                       PrepareCommand command)

releaseForCommand

void releaseForCommand(TxInvocationContext ctx,
                       CommitCommand command)

releaseForCommand

void releaseForCommand(TxInvocationContext ctx,
                       RollbackCommand command)

releaseForCommand

void releaseForCommand(TxInvocationContext ctx,
                       LockControlCommand cmd)

blockNewTransactions

void blockNewTransactions(int cacheViewId)
                          throws InterruptedException
Throws:
InterruptedException

unblockNewTransactions

void unblockNewTransactions(int cacheViewId)

blockNewTransactionsAsync

void blockNewTransactionsAsync()

areNewTransactionsBlocked

boolean areNewTransactionsBlocked()

getBlockingCacheViewId

int getBlockingCacheViewId()

waitForStateTransferToEnd

void waitForStateTransferToEnd(InvocationContext ctx,
                               VisitableCommand command,
                               int newCacheViewId)
                               throws TimeoutException,
                                      InterruptedException,
                                      StateTransferLockReacquisitionException
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.

Throws:
StateTransferLockReacquisitionException - Unlike the acquireForCommand methods, it throws a StateTransferLockReacquisitionException if it can't acquire the state transfer lock back.
TimeoutException
InterruptedException

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.