org.infinispan.distribution
Class TransactionLoggerImpl

java.lang.Object
  extended by org.infinispan.distribution.TransactionLoggerImpl
All Implemented Interfaces:
TransactionLogger

public class TransactionLoggerImpl
extends Object
implements TransactionLogger

// TODO: Manik: Document this

Since:
4.0
Author:
Manik Surtani

Constructor Summary
TransactionLoggerImpl()
           
 
Method Summary
 List<WriteCommand> drain()
          Drains the transaction log and returns a list of what has been drained.
 List<WriteCommand> drainAndLock()
          Similar to TransactionLogger.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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionLoggerImpl

public TransactionLoggerImpl()
Method Detail

enable

public void enable()
Specified by:
enable in interface TransactionLogger

drain

public List<WriteCommand> drain()
Description copied from interface: TransactionLogger
Drains the transaction log and returns a list of what has been drained.

Specified by:
drain in interface TransactionLogger
Returns:
a list of drained commands

drainAndLock

public List<WriteCommand> drainAndLock()
Description copied from interface: TransactionLogger
Similar to TransactionLogger.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.

Specified by:
drainAndLock in interface TransactionLogger
Returns:
list of drained commands

unlockAndDisable

public void unlockAndDisable()
Specified by:
unlockAndDisable in interface TransactionLogger

logIfNeeded

public boolean logIfNeeded(WriteCommand command)
Description copied from interface: TransactionLogger
If logging is enabled, will log the command and return true. Otherwise, will just return false.

Specified by:
logIfNeeded in interface TransactionLogger
Parameters:
command - command to log
Returns:
true if logged, false otherwise

logIfNeeded

public void logIfNeeded(PrepareCommand command)
Specified by:
logIfNeeded in interface TransactionLogger

logIfNeeded

public void logIfNeeded(CommitCommand command)
Specified by:
logIfNeeded in interface TransactionLogger

logIfNeeded

public void logIfNeeded(RollbackCommand command)
Specified by:
logIfNeeded in interface TransactionLogger

logIfNeeded

public boolean logIfNeeded(Collection<WriteCommand> commands)
Description copied from interface: TransactionLogger
If logging is enabled, will log the commands and return true. Otherwise, will just return false.

Specified by:
logIfNeeded in interface TransactionLogger
Parameters:
commands - commands to log
Returns:
true if logged, false otherwise

size

public int size()
Specified by:
size in interface TransactionLogger

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface TransactionLogger

Google Analytics

Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.