|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.DBTransactionStoreAdapter
public abstract class DBTransactionStoreAdapter
convenience class to extend from when implementing something like a DatabaseChangeMonitor
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.antelmann.db.TransactionListener |
|---|
TransactionListener.Adapter |
| Nested classes/interfaces inherited from interface com.antelmann.db.DBStoreListener |
|---|
DBStoreListener.Adapter, DBStoreListener.StoreUpdateAdapter |
| Constructor Summary | |
|---|---|
DBTransactionStoreAdapter()
|
|
| Method Summary | |
|---|---|
void |
databaseAccessed(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter,
long timeTaken)
called upon successfully reading from the database (guaranteed to be called from within the transaction). |
void |
databaseError(DBClassStore<?> dbstore,
Throwable t,
DBClassStore.DBMethod method,
Object parameter)
called when an error occurred while accessing the database (not guaranteed to be called from within the transaction) |
void |
databaseUpdated(DBUpdateEvent event,
long timeTaken)
called upon successful insert, delete or update; note that the update becomes permanent ONLY if the current transaction successfully commits. |
void |
fetchCall(DBClassStore<?> dbstore,
DBEnumeration<?> e,
String method,
long timeTaken)
called when a method is called on a DBEnumeration that is returned by the store |
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 |
prepareDatabaseCall(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter)
called before the given method is delegated to the embedded store |
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 |
|---|
public DBTransactionStoreAdapter()
| Method Detail |
|---|
public void prepareDatabaseCall(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter)
throws DBVetoException
DBStoreListener
prepareDatabaseCall in interface DBStoreListenerDBVetoException - if a listener seeks to prevent the call to the embedded store
public void databaseUpdated(DBUpdateEvent event,
long timeTaken)
throws DBVetoException
DBStoreListener
databaseUpdated in interface DBStoreListenerDBVetoException - if the listener explicitly wants to prevent the update from occurring;
this exception is then propagatedTransactionListener,
DatabaseChangeMonitor,
DBVersionedUpdateEvent,
Database.setVersioningEnabled(Class, boolean)
public void databaseAccessed(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter,
long timeTaken)
DBStoreListenerDBStoreListener.databaseUpdated(DBUpdateEvent, long)
is called.
databaseAccessed in interface DBStoreListener
public void databaseError(DBClassStore<?> dbstore,
Throwable t,
DBClassStore.DBMethod method,
Object parameter)
DBStoreListener
databaseError in interface DBStoreListener
public void fetchCall(DBClassStore<?> dbstore,
DBEnumeration<?> e,
String method,
long timeTaken)
DBStoreListener
fetchCall in interface DBStoreListenerDBClassStore.fetch(com.antelmann.util.Filter),
DBClassStore.fetchStubs(com.antelmann.util.Filter),
DBEnumerationpublic void transactionBegin(DBTransaction transaction)
TransactionListener
transactionBegin in interface TransactionListener
public void finishTransaction(DBTransaction transaction)
throws DatabaseException
TransactionListenerTransactionListener.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.
finishTransaction in interface TransactionListenerDatabaseExceptionpublic void prepareToCommit(DBTransaction transaction)
TransactionListenerTransactionListener.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.
prepareToCommit in interface TransactionListenertransaction - the transaction (being still active) that is about to be committedpublic void transactionCommitted(DBTransaction transaction)
TransactionListenerTransactionException 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.
transactionCommitted in interface TransactionListenerpublic void transactionAborted(DBTransaction transaction)
TransactionListenerTransactionException 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.
transactionAborted in interface TransactionListener
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||