|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.subshell.persistence.runner.SimpleTransactionContextRunner
public class SimpleTransactionContextRunner
Runs a Runnable
and provides it with a transaction context. This class will take care
of setting up/destroying the transaction context. Additionally, it will commit/roll back the
Transaction
as necessary.
Note: The transaction must not be committed/rolled back by the Runnable.
Instances of this class are thread-safe, as must be instances of subclasses of this class.
Constructor Summary | |
---|---|
SimpleTransactionContextRunner()
|
Method Summary | |
---|---|
protected Transaction |
openTransaction()
Opens and returns a new transaction. |
void |
run(Runnable runnable)
Runs the specified Runnable and provides it with a transaction context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleTransactionContextRunner()
Method Detail |
---|
public final void run(Runnable runnable) throws ErrorInRunnableException, PersistenceException
Runs the specified Runnable and provides it with a transaction context. This method takes care of setting up/destroying the transaction context. It will also commit/roll back the transaction as necessary.
Note: The transaction must not be committed/rolled back by the Runnable.
run
in interface TransactionContextRunner
ErrorInRunnableException
- when the Runnable itself has thrown an exception
PersistenceException
- when there is a persistence-related errorprotected Transaction openTransaction() throws PersistenceException
Opens and returns a new transaction.
This method obtains a database from the database factory and uses it to open the transaction. Subclasses may override this method to provide an alternative implementation.
PersistenceException
- when there is a persistence-related error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |