|
||||||||||
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)
|
Method Summary | |
---|---|
void |
afterCommand(CommitCommand command,
TxInvocationContext context)
Logs a CommitCommand if needed. |
void |
afterCommand(PrepareCommand command)
Logs a PrepareCommand if needed. |
void |
afterCommand(RollbackCommand command)
Logs a RollbackCommand if needed. |
void |
afterCommand(WriteCommand command)
Logs a write command (if needed). |
void |
beforeCommand(CommitCommand command,
TxInvocationContext context)
Notify the transaction logger before a commit command, potentially blocking. |
void |
beforeCommand(PrepareCommand command)
Notify the transaction logger before a prepare command, potentially blocking. |
void |
beforeCommand(RollbackCommand command)
Notify the transaction logger before a rollback command, potentially blocking. |
void |
beforeCommand(WriteCommand command)
Notify the transaction logger before a write 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 |
boolean |
shouldDrainWithoutLock()
Tests whether the drain() method can be called without a lock. |
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)
Method Detail |
---|
public void enable()
TransactionLogger
enable
in interface TransactionLogger
public List<WriteCommand> drain()
RemoteTransactionLogger
drain
in interface RemoteTransactionLogger
public List<WriteCommand> drainAndLock() throws InterruptedException
RemoteTransactionLogger
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.
drainAndLock
in interface RemoteTransactionLogger
InterruptedException
public void unlockAndDisable()
RemoteTransactionLogger
RemoteTransactionLogger.drainAndLock()
.
unlockAndDisable
in interface RemoteTransactionLogger
public void afterCommand(WriteCommand command) throws InterruptedException
TransactionLogger
afterCommand
in interface TransactionLogger
command
- command to log
InterruptedException
public void afterCommand(PrepareCommand command) throws InterruptedException
TransactionLogger
afterCommand
in interface TransactionLogger
command
- PrepoareCommand to log
InterruptedException
public void afterCommand(CommitCommand command, TxInvocationContext context) throws InterruptedException
TransactionLogger
afterCommand
in interface TransactionLogger
command
- CommitCommand to log
InterruptedException
public void afterCommand(RollbackCommand command)
TransactionLogger
afterCommand
in interface TransactionLogger
command
- RollbackCommand to logpublic void beforeCommand(WriteCommand command) throws InterruptedException
TransactionLogger
beforeCommand
in interface TransactionLogger
InterruptedException
public void beforeCommand(PrepareCommand command) throws InterruptedException
TransactionLogger
beforeCommand
in interface TransactionLogger
InterruptedException
public void beforeCommand(CommitCommand command, TxInvocationContext context) throws InterruptedException
TransactionLogger
beforeCommand
in interface TransactionLogger
InterruptedException
public void beforeCommand(RollbackCommand command) throws InterruptedException
TransactionLogger
beforeCommand
in interface TransactionLogger
InterruptedException
public boolean isEnabled()
TransactionLogger
isEnabled
in interface TransactionLogger
public boolean shouldDrainWithoutLock()
RemoteTransactionLogger
shouldDrainWithoutLock
in interface RemoteTransactionLogger
public Collection<PrepareCommand> getPendingPrepares()
RemoteTransactionLogger
getPendingPrepares
in interface RemoteTransactionLogger
public void blockNewTransactions() throws InterruptedException
TransactionLogger
beforeCommand()
.
blockNewTransactions
in interface TransactionLogger
InterruptedException
public void unblockNewTransactions()
TransactionLogger
beforeCommand()
.
unblockNewTransactions
in interface TransactionLogger
public String toString()
toString
in class Object
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |