com.bigdata.journal
Class AbstractLocalTransactionManager

java.lang.Object
  extended by com.bigdata.journal.AbstractLocalTransactionManager
All Implemented Interfaces:
ILocalTransactionManager, IServiceShutdown
Direct Known Subclasses:
DataService.DataServiceTransactionManager

public abstract class AbstractLocalTransactionManager
extends Object
implements ILocalTransactionManager

Manages the client side of a transaction either for a standalone Journal or for an IDataService in an IBigdataFederation.

Version:
$Id: AbstractLocalTransactionManager.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bigdata.service.IServiceShutdown
IServiceShutdown.Options
 
Field Summary
protected static boolean DEBUG
          True iff the log level is DEBUG or less.
protected static boolean INFO
          True iff the log level is INFO or less.
protected static org.apache.log4j.Logger log
          Logger.
 
Constructor Summary
AbstractLocalTransactionManager()
           
 
Method Summary
 void activateTx(Tx localState)
          Notify the journal that a new transaction is being activated (starting on the journal).
protected  void deactivateTx(Tx localState)
          Removes the transaction from the local tables.
 CounterSet getCounters()
          Return interesting statistics about the transaction manager.
 Tx getTx(long tx)
          Return the local state for a transaction.
 boolean isOpen()
          Return true iff the service is running.
 long nextTimestamp()
          Note: The reason for all this retry logic is to work around race conditions during service startup (and possibly during service failover) when the ITimestampService has not been discovered yet.
 void notifyCommit(long commitTime)
          Notify the global transaction manager that a commit has been performed with the given timestamp (which it assigned) and that it should update its lastCommitTime iff the given commitTime is GT its current lastCommitTime.
 void shutdown()
          The service will no longer accept new requests, but existing requests will be processed (sychronous).
 void shutdownNow()
          The service will no longer accept new requests and will make a best effort attempt to terminate all existing requests and return ASAP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.journal.ILocalTransactionManager
getTransactionService
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Logger.


INFO

protected static final boolean INFO
True iff the log level is INFO or less.


DEBUG

protected static final boolean DEBUG
True iff the log level is DEBUG or less.

Constructor Detail

AbstractLocalTransactionManager

public AbstractLocalTransactionManager()
Method Detail

activateTx

public void activateTx(Tx localState)
                throws IllegalStateException
Notify the journal that a new transaction is being activated (starting on the journal).

Parameters:
localState - The transaction.
Throws:
IllegalStateException

deactivateTx

protected void deactivateTx(Tx localState)
                     throws IllegalStateException
Removes the transaction from the local tables.

Parameters:
localState - The transaction.
Throws:
IllegalStateException

getTx

public Tx getTx(long tx)
Return the local state for a transaction.

Specified by:
getTx in interface ILocalTransactionManager
Parameters:
tx - The transaction identifier.
Returns:
The local state for the identified transaction -or- null if the start time is not mapped to either an active or prepared transaction.

isOpen

public boolean isOpen()
Description copied from interface: IServiceShutdown
Return true iff the service is running.

Specified by:
isOpen in interface IServiceShutdown

shutdown

public void shutdown()
Description copied from interface: IServiceShutdown
The service will no longer accept new requests, but existing requests will be processed (sychronous). This method should await the termination of pending requests, but no longer than the timeout specified by IServiceShutdown.Options.SHUTDOWN_TIMEOUT. Implementations SHOULD be synchronized. If the service is aleady shutdown, then this method should be a NOP.

Specified by:
shutdown in interface IServiceShutdown

shutdownNow

public void shutdownNow()
Description copied from interface: IServiceShutdown
The service will no longer accept new requests and will make a best effort attempt to terminate all existing requests and return ASAP. This method should terminate any asynchronous processing, release all resources and return immediately. Implementations SHOULD be synchronized. If the service is aleady shutdown, then this method should be a NOP.

Specified by:
shutdownNow in interface IServiceShutdown

nextTimestamp

public long nextTimestamp()
Note: The reason for all this retry logic is to work around race conditions during service startup (and possibly during service failover) when the ITimestampService has not been discovered yet.

Specified by:
nextTimestamp in interface ILocalTransactionManager
Returns:
The next timestamp assigned by the ITransactionService.
See Also:
ITimestampService.nextTimestamp()

notifyCommit

public void notifyCommit(long commitTime)
Description copied from interface: ILocalTransactionManager
Notify the global transaction manager that a commit has been performed with the given timestamp (which it assigned) and that it should update its lastCommitTime iff the given commitTime is GT its current lastCommitTime.

Specified by:
notifyCommit in interface ILocalTransactionManager
Parameters:
commitTime - The commit time.
See Also:
ITransactionService.notifyCommit(long)

getCounters

public CounterSet getCounters()
Return interesting statistics about the transaction manager.



Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.