Holger's
Java API

com.antelmann.db
Class LoggerTransactionListener

java.lang.Object
  extended by com.antelmann.db.LoggerTransactionListener
All Implemented Interfaces:
TransactionListener

public class LoggerTransactionListener
extends Object
implements TransactionListener

Since:
16.08.2010, 03:03:40
Author:
holger

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.antelmann.db.TransactionListener
TransactionListener.Adapter
 
Constructor Summary
LoggerTransactionListener(Logger logger, Level level)
           
 
Method Summary
 void finishTransaction(DBTransaction transaction)
          called before the transaction commits (and before TransactionListener.prepareToCommit(DBTransaction)), so that the commit at the database level can be prevented by throwing a DatabaseException here.
 void prepareToCommit(DBTransaction transaction)
          called right before the transaction actually commits and after TransactionListener.finishTransaction(DBTransaction).
 void transactionAborted(DBTransaction transaction)
          called after a database transaction was aborted; the transaction is already inactive.
 void transactionBegin(DBTransaction transaction)
          called upon beginning a transaction (the transaction is already active)
 void transactionCommitted(DBTransaction transaction)
          called after a successful database commit; the transaction is already inactive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerTransactionListener

public LoggerTransactionListener(Logger logger,
                                 Level level)
Method Detail

finishTransaction

public void finishTransaction(DBTransaction transaction)
                       throws DatabaseException
Description copied from interface: TransactionListener
called before the transaction commits (and before TransactionListener.prepareToCommit(DBTransaction)), so that the commit at the database level can be prevented by throwing a DatabaseException here. This method can also be used to make some updates on another database or checking on certain data before the transaction is allowed to commit. In other words, this method may effectively veto the commit of a transaction After this call, the transaction is soon either going to be committed or aborted (right after all listeners have been called). As this method runs within the transaction, it is possible to access/update any resources from the database.

Specified by:
finishTransaction in interface TransactionListener
Throws:
DatabaseException

prepareToCommit

public void prepareToCommit(DBTransaction transaction)
Description copied from interface: TransactionListener
called right before the transaction actually commits and after TransactionListener.finishTransaction(DBTransaction). Any exception thrown is ignored; listeners must not do any lengthy operations here. This may be used for supporting the implementation of a 2-phase-commit.

Specified by:
prepareToCommit in interface TransactionListener
Parameters:
transaction - the transaction (being still active) that is about to be committed

transactionAborted

public void transactionAborted(DBTransaction transaction)
Description copied from interface: TransactionListener
called after a database transaction was aborted; the transaction is already inactive. Note that you cannot to start a new transaction within the call of this method, since subsequent listeners would not have a chance to react on this transaction end. If the implementation of this method tries to begin a new transaction, a TransactionException will be thrown. If you need to access/update resources of this database from this method, start a new thread that opens a new transaction.

Specified by:
transactionAborted in interface TransactionListener

transactionBegin

public void transactionBegin(DBTransaction transaction)
Description copied from interface: TransactionListener
called upon beginning a transaction (the transaction is already active)

Specified by:
transactionBegin in interface TransactionListener

transactionCommitted

public void transactionCommitted(DBTransaction transaction)
Description copied from interface: TransactionListener
called after a successful database commit; the transaction is already inactive. Note that you cannot start a new transaction within the call of this method, since subsequent listeners would not have a chance to react on this transaction end. If the implementation of this method tries to begin a new transaction, a TransactionException will be thrown. If you need to access/update resources of this database from this method, start a new thread that opens a new transaction.

Specified by:
transactionCommitted in interface TransactionListener


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads