|
||||||||||
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.logIfNeeded(cmd)) { // do NOT proceed with executing this command! } else { // proceed with
executing this command as per normal! }
When draining, the following pattern should be used:
List c = null; while (txLogger.size() > THRESHOLD) { c = txLogger.drain(); applyCommands(c); } c
= txLogger.drainAndLock(); applyCommands(c); txLogger.unlockAndDisable();
Method Summary | |
---|---|
List<WriteCommand> |
drain()
Drains the transaction log and returns a list of what has been drained. |
List<WriteCommand> |
drainAndLock()
Similar to 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()
|
boolean |
isEnabled()
|
boolean |
logIfNeeded(Collection<WriteCommand> commands)
If logging is enabled, will log the commands and return true. |
void |
logIfNeeded(CommitCommand command)
|
void |
logIfNeeded(PrepareCommand command)
|
void |
logIfNeeded(RollbackCommand command)
|
boolean |
logIfNeeded(WriteCommand command)
If logging is enabled, will log the command and return true. |
int |
size()
|
void |
unlockAndDisable()
|
Method Detail |
---|
void enable()
List<WriteCommand> drain()
List<WriteCommand> drainAndLock()
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 unlockAndDisable()
boolean logIfNeeded(WriteCommand command)
command
- command to log
void logIfNeeded(PrepareCommand command)
void logIfNeeded(CommitCommand command)
void logIfNeeded(RollbackCommand command)
boolean logIfNeeded(Collection<WriteCommand> commands)
commands
- commands to log
int size()
boolean isEnabled()
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |