|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.infinispan.distribution.TransactionLoggerImpl
public class TransactionLoggerImpl
A transaction logger to log ongoing transactions in an efficient and thread-safe manner while a rehash is going on.
Transaction logs can then be replayed after the state transferred during a rehash has been written.
| Constructor Summary | |
|---|---|
TransactionLoggerImpl(CommandsFactory cf,
Configuration config)
|
|
| Method Summary | |
|---|---|
void |
afterCommand(InvocationContext ctx,
WriteCommand command)
Logs a write command (if needed). |
void |
afterCommand(TxInvocationContext ctx,
CommitCommand command)
Logs a CommitCommand if needed. |
void |
afterCommand(TxInvocationContext ctx,
LockControlCommand command)
Notify the transaction logger after a lock control command. |
void |
afterCommand(TxInvocationContext ctx,
PrepareCommand command)
Logs a PrepareCommand if needed. |
void |
afterCommand(TxInvocationContext ctx,
RollbackCommand command)
Logs a RollbackCommand if needed. |
boolean |
areTransactionsBlocked()
|
boolean |
beforeCommand(InvocationContext ctx,
WriteCommand command)
Notify the transaction logger before a write command, potentially blocking. |
boolean |
beforeCommand(TxInvocationContext ctx,
CommitCommand command)
Notify the transaction logger before a commit command, potentially blocking. |
boolean |
beforeCommand(TxInvocationContext ctx,
LockControlCommand cmd)
Notify the transaction logger before a lock control command, potentially blocking |
boolean |
beforeCommand(TxInvocationContext ctx,
PrepareCommand command)
Notify the transaction logger before a prepare command, potentially blocking. |
boolean |
beforeCommand(TxInvocationContext ctx,
RollbackCommand command)
Notify the transaction logger before a rollback command, potentially blocking. |
void |
blockNewTransactions()
Causes new transactions to block when calling beforeCommand(). |
List<WriteCommand> |
drain()
Drains the transaction log and returns a list of what has been drained. |
List<WriteCommand> |
drainAndLock()
Similar to RemoteTransactionLogger.drain() except that relevant locks are acquired so that no more commands are added to the
transaction log during this process, and transaction logging is disabled after draining. |
void |
enable()
Enables transaction logging |
Collection<PrepareCommand> |
getPendingPrepares()
Drains pending prepares. |
boolean |
isEnabled()
Checks whether transaction logging is enabled |
void |
resumeTransactionLock(InvocationContext ctx)
Re-acquire the transaction lock when a remote call returns. |
boolean |
shouldDrainWithoutLock()
Tests whether the drain() method can be called without a lock. |
void |
suspendTransactionLock(InvocationContext ctx)
Use before synchronous remote calls, as the remote call will also try to acquire the transaction lock on that node. |
String |
toString()
|
void |
unblockNewTransactions()
Unblocks anything blocking on beforeCommand(). |
void |
unlockAndDisable()
Unlocks and disables the transaction logger. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TransactionLoggerImpl(CommandsFactory cf,
Configuration config)
| Method Detail |
|---|
public void enable()
TransactionLogger
enable in interface TransactionLoggerpublic List<WriteCommand> drain()
RemoteTransactionLogger
drain in interface RemoteTransactionLogger
public List<WriteCommand> drainAndLock()
throws InterruptedException
RemoteTransactionLoggerRemoteTransactionLogger.drain() except that relevant locks are acquired so that no more commands are added to the
transaction log during this process, and transaction logging is disabled after draining.
drainAndLock in interface RemoteTransactionLoggerInterruptedExceptionpublic void unlockAndDisable()
RemoteTransactionLoggerRemoteTransactionLogger.drainAndLock().
unlockAndDisable in interface RemoteTransactionLogger
public void afterCommand(InvocationContext ctx,
WriteCommand command)
throws InterruptedException
TransactionLogger
afterCommand in interface TransactionLoggercommand - command to log
InterruptedException
public void afterCommand(TxInvocationContext ctx,
PrepareCommand command)
throws InterruptedException
TransactionLogger
afterCommand in interface TransactionLoggercommand - PrepoareCommand to log
InterruptedException
public void afterCommand(TxInvocationContext ctx,
CommitCommand command)
throws InterruptedException
TransactionLogger
afterCommand in interface TransactionLoggercommand - CommitCommand to log
InterruptedException
public void afterCommand(TxInvocationContext ctx,
RollbackCommand command)
TransactionLogger
afterCommand in interface TransactionLoggercommand - RollbackCommand to log
public void afterCommand(TxInvocationContext ctx,
LockControlCommand command)
TransactionLogger
afterCommand in interface TransactionLogger
public boolean beforeCommand(InvocationContext ctx,
WriteCommand command)
throws InterruptedException,
TimeoutException
TransactionLogger
beforeCommand in interface TransactionLoggertrue if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
public boolean beforeCommand(TxInvocationContext ctx,
PrepareCommand command)
throws InterruptedException,
TimeoutException
TransactionLogger
beforeCommand in interface TransactionLoggertrue if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
public boolean beforeCommand(TxInvocationContext ctx,
CommitCommand command)
throws InterruptedException,
TimeoutException
TransactionLogger
beforeCommand in interface TransactionLoggertrue if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
public boolean beforeCommand(TxInvocationContext ctx,
RollbackCommand command)
throws InterruptedException,
TimeoutException
TransactionLogger
beforeCommand in interface TransactionLoggertrue if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
public boolean beforeCommand(TxInvocationContext ctx,
LockControlCommand cmd)
throws TimeoutException,
InterruptedException
TransactionLogger
beforeCommand in interface TransactionLoggertrue if the transaction can proceed, false otherwise
TimeoutException
InterruptedExceptionpublic void suspendTransactionLock(InvocationContext ctx)
TransactionLogger
suspendTransactionLock in interface TransactionLogger
public void resumeTransactionLock(InvocationContext ctx)
throws TimeoutException,
InterruptedException
TransactionLogger
resumeTransactionLock in interface TransactionLoggerTimeoutException
InterruptedExceptionpublic boolean isEnabled()
TransactionLogger
isEnabled in interface TransactionLoggerpublic boolean shouldDrainWithoutLock()
RemoteTransactionLogger
shouldDrainWithoutLock in interface RemoteTransactionLoggerpublic Collection<PrepareCommand> getPendingPrepares()
RemoteTransactionLogger
getPendingPrepares in interface RemoteTransactionLogger
public void blockNewTransactions()
throws InterruptedException
TransactionLoggerbeforeCommand().
blockNewTransactions in interface TransactionLoggerInterruptedExceptionpublic void unblockNewTransactions()
TransactionLoggerbeforeCommand().
unblockNewTransactions in interface TransactionLoggerpublic boolean areTransactionsBlocked()
areTransactionsBlocked in interface TransactionLoggertrue if new transactions are blocked and false otherwise.public String toString()
toString in class Object
|
--> | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||