|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface TransactionLogger
Typically adding a command, the following pattern would be used:
if (txLogger.beforeCommand()) {
try {
// execute this command!
} finally {
txLogger.afterCommand(cmd);
}
}
When draining, the following pattern should be used:
List<WriteCommand> c = null;
while (txLogger.shouldDrainWithoutLock()) {
c = txLogger.drain();
applyCommands(c);
}
c = txLogger.drainAndLock();
applyCommands(c);
applyPendingPrepares(txLogger.getPendingPrepares());
txLogger.unlockAndDisable();
| 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 cmd)
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(). |
void |
enable()
Enables transaction logging |
boolean |
isEnabled()
Checks whether transaction logging is enabled |
void |
resumeTransactionLock(InvocationContext ctx)
Re-acquire the transaction lock when a remote call returns. |
void |
suspendTransactionLock(InvocationContext ctx)
Use before synchronous remote calls, as the remote call will also try to acquire the transaction lock on that node. |
void |
unblockNewTransactions()
Unblocks anything blocking on beforeCommand(). |
| Methods inherited from interface org.infinispan.distribution.RemoteTransactionLogger |
|---|
drain, drainAndLock, getPendingPrepares, shouldDrainWithoutLock, unlockAndDisable |
| Method Detail |
|---|
void enable()
void afterCommand(InvocationContext ctx,
WriteCommand command)
throws InterruptedException
command - command to log
InterruptedException
void afterCommand(TxInvocationContext ctx,
PrepareCommand command)
throws InterruptedException
command - PrepoareCommand to log
InterruptedException
void afterCommand(TxInvocationContext ctx,
CommitCommand command)
throws InterruptedException
command - CommitCommand to log
InterruptedException
void afterCommand(TxInvocationContext ctx,
RollbackCommand command)
throws InterruptedException
command - RollbackCommand to log
InterruptedException
void afterCommand(TxInvocationContext ctx,
LockControlCommand cmd)
boolean isEnabled()
boolean beforeCommand(InvocationContext ctx,
WriteCommand command)
throws InterruptedException,
TimeoutException
true if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
boolean beforeCommand(TxInvocationContext ctx,
PrepareCommand command)
throws InterruptedException,
TimeoutException
true if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
boolean beforeCommand(TxInvocationContext ctx,
CommitCommand command)
throws InterruptedException,
TimeoutException
true if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
boolean beforeCommand(TxInvocationContext ctx,
RollbackCommand command)
throws InterruptedException,
TimeoutException
true if the transaction can proceed, false otherwise
InterruptedException
TimeoutException
boolean beforeCommand(TxInvocationContext ctx,
LockControlCommand cmd)
throws TimeoutException,
InterruptedException
true if the transaction can proceed, false otherwise
TimeoutException
InterruptedExceptionvoid suspendTransactionLock(InvocationContext ctx)
void resumeTransactionLock(InvocationContext ctx)
throws TimeoutException,
InterruptedException
TimeoutException
InterruptedException
void blockNewTransactions()
throws InterruptedException
beforeCommand().
InterruptedException
void unblockNewTransactions()
throws InterruptedException
beforeCommand().
InterruptedExceptionboolean areTransactionsBlocked()
true if new transactions are blocked and false otherwise.
|
--> | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||