|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface TransactionListener
listens for DBTransaction changes and can potentially intervene upon preparing for a commit. This interface may also be used to provide rudimentary XA support.
DBTransaction,
DatabaseChangeMonitor,
DBStoreListener,
Database| Nested Class Summary | |
|---|---|
static class |
TransactionListener.Adapter
provides convenient empty implementations for all methods |
| Method Summary | |
|---|---|
void |
finishTransaction(DBTransaction transaction)
called before the transaction commits (and before 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 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. |
| Method Detail |
|---|
void transactionBegin(DBTransaction transaction)
void finishTransaction(DBTransaction transaction)
throws DatabaseException
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.
DatabaseExceptionvoid prepareToCommit(DBTransaction transaction)
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.
transaction - the transaction (being still active) that is about to be committed@Warning(value="do not directly start a new transaction when implementing this method") void transactionCommitted(DBTransaction transaction)
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.
@Warning(value="do not directly start a new transaction when implementing this method") void transactionAborted(DBTransaction transaction)
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.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||