|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.subshell.persistence.runner.SelfContainedTransactionContextRunner
public class SelfContainedTransactionContextRunner
Runs a Runnable
and provides it with a self-contained transaction context. That is,
the transaction context of the current thread will not be affected in any way.
This class will take care of setting up/destroying the new transaction context.
Additionally, it will commit/roll back the Transaction
as necessary.
Instances of SelfContainedTransactionContextRunner may be nested, that is, a Runnable which is run in a SelfContainedTransactionContextRunner may itself use a SelfContainedTransactionContextRunner, and so on.
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 | |
---|---|
SelfContainedTransactionContextRunner()
|
Method Summary | |
---|---|
protected TransactionContextRunner |
createTransactionContextRunner()
Creates and returns a new transaction context runner to be used inside the self-contained transaction context runner. |
void |
run(Runnable runnable)
Runs the specified Runnable and provides it with a self-contained transaction context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SelfContainedTransactionContextRunner()
Method Detail |
---|
public final void run(Runnable runnable) throws ErrorInRunnableException, PersistenceException
Runs the specified Runnable and provides it with a self-contained transaction context. That is, the transaction context of the current thread will not be affected in any way. This method takes care of setting up/destroying the new 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 TransactionContextRunner createTransactionContextRunner()
Creates and returns a new transaction context runner to be used inside the self-contained transaction context runner.
This method creates a new SimpleTransactionContextRunner. Subclasses may override this method to provide an alternative implementation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |