|
||||||||||
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 |
blockNewTransactions()
Causes new transactions to block when testing isEnabled(). |
List<WriteCommand> |
drain()
Drains the transaction log and returns a list of what has been drained. |
List<WriteCommand> |
drainAndLock(Address lockedFor)
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 |
logIfNeeded(CommitCommand command,
TxInvocationContext context)
Logs a CommitCommand if needed. |
void |
logIfNeeded(PrepareCommand command)
Logs a PrepareCommand if needed. |
void |
logIfNeeded(RollbackCommand command)
Logs a RollbackCommand if needed. |
boolean |
logIfNeeded(WriteCommand command)
If logging is enabled, will log the command and return true. |
void |
logModificationsIfNeeded(CommitCommand commit,
TxInvocationContext context)
A mechanism for commit commands to register modifications instead of a prepare. |
boolean |
shouldDrainWithoutLock()
Tests whether the drain() method can be called without a lock. |
String |
toString()
|
void |
unblockNewTransactions()
Unblocks anything blocking on isEnabled(). |
void |
unlockAndDisable(Address lockedFor)
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(Address lockedFor)
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
public void unlockAndDisable(Address lockedFor)
RemoteTransactionLogger
#drainAndLock()
.
unlockAndDisable
in interface RemoteTransactionLogger
public boolean logIfNeeded(WriteCommand command)
TransactionLogger
logIfNeeded
in interface TransactionLogger
command
- command to log
public void logIfNeeded(PrepareCommand command)
TransactionLogger
logIfNeeded
in interface TransactionLogger
command
- PrepoareCommand to logpublic void logModificationsIfNeeded(CommitCommand commit, TxInvocationContext context)
TransactionLogger
logModificationsIfNeeded
in interface TransactionLogger
commit
- commit commandcontext
- context from which to extract modification listpublic void logIfNeeded(CommitCommand command, TxInvocationContext context)
TransactionLogger
logIfNeeded
in interface TransactionLogger
command
- CommitCommand to logpublic void logIfNeeded(RollbackCommand command)
TransactionLogger
logIfNeeded
in interface TransactionLogger
command
- RollbackCommand to logpublic 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()
TransactionLogger
blockNewTransactions
in interface TransactionLogger
public void unblockNewTransactions()
TransactionLogger
unblockNewTransactions
in interface TransactionLogger
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |