org.infinispan.distribution
Class RemoteTransactionLoggerImpl

java.lang.Object
  extended by org.infinispan.distribution.RemoteTransactionLoggerImpl
All Implemented Interfaces:
RemoteTransactionLogger

public class RemoteTransactionLoggerImpl
extends Object
implements RemoteTransactionLogger

This abstraction performs RPCs and works on a TransactionLogger located on a remote node.

Since:
4.2.1
Author:
Manik Surtani

Constructor Summary
RemoteTransactionLoggerImpl(CommandsFactory commandsFactory, Address targetNode, RpcManager rpcManager)
           
 
Method Summary
 List<WriteCommand> drain()
          Drains the transaction log and returns a list of what has been drained.
 List<WriteCommand> drainAndLock(Address notUsed)
          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.
 Collection<PrepareCommand> getPendingPrepares()
          Drains pending prepares.
 boolean shouldDrainWithoutLock()
          Tests whether the drain() method can be called without a lock.
 void unlockAndDisable(Address notUsed)
          Unlocks and disables the transaction logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteTransactionLoggerImpl

public RemoteTransactionLoggerImpl(CommandsFactory commandsFactory,
                                   Address targetNode,
                                   RpcManager rpcManager)
Method Detail

drain

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

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

drainAndLock

public List<WriteCommand> drainAndLock(Address notUsed)
Description copied from interface: RemoteTransactionLogger
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.

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

shouldDrainWithoutLock

public boolean shouldDrainWithoutLock()
Description copied from interface: RemoteTransactionLogger
Tests whether the drain() method can be called without a lock. This is usually true if there is a lot of stuff to drain. After a certain threshold (once there are relatively few entries in the tx log) this will return false after which you should call drainAndLock() to clear the final parts of the log.

Specified by:
shouldDrainWithoutLock in interface RemoteTransactionLogger
Returns:
true if drain() should be called, false if drainAndLock() should be called.

getPendingPrepares

public Collection<PrepareCommand> getPendingPrepares()
Description copied from interface: RemoteTransactionLogger
Drains pending prepares. Note that this should *only* be done after calling drainAndLock() to prevent race conditions

Specified by:
getPendingPrepares in interface RemoteTransactionLogger
Returns:
a list of prepares pending commit or rollback

unlockAndDisable

public void unlockAndDisable(Address notUsed)
Description copied from interface: RemoteTransactionLogger
Unlocks and disables the transaction logger. Should only be called after #drainAndLock().

Specified by:
unlockAndDisable in interface RemoteTransactionLogger


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