public class TransactionImpl extends java.lang.Object implements Transaction
Transaction.Callable<T>, Transaction.Runnable
Constructor and Description |
---|
TransactionImpl(org.springframework.transaction.PlatformTransactionManager transactionManager,
PersistenceImpl persistence,
boolean join,
TransactionParams params,
java.lang.String storeName) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
commit()
Commit current transaction.
|
void |
commitRetaining()
Commit current transaction and immediately start a new one.
|
void |
end()
This method has to be invoked in the following construct:
|
<T> T |
execute(java.lang.String storeName,
Transaction.Callable<T> callable)
Executes the action specified by the given single method object within a transaction.
|
void |
execute(java.lang.String storeName,
Transaction.Runnable runnable)
Executes the action specified by the given single method object within a transaction.
|
<T> T |
execute(Transaction.Callable<T> callable)
Executes the action specified by the given single method object within a transaction in the main data store.
|
void |
execute(Transaction.Runnable runnable)
Executes the action specified by the given single method object within a transaction in the main data store.
|
public TransactionImpl(org.springframework.transaction.PlatformTransactionManager transactionManager, PersistenceImpl persistence, boolean join, @Nullable TransactionParams params, java.lang.String storeName)
public <T> T execute(Transaction.Callable<T> callable)
Transaction
execute
in interface Transaction
Transaction.execute(String, Callable)
public <T> T execute(java.lang.String storeName, Transaction.Callable<T> callable)
Transaction
RuntimeException
thrown in the transactional code enforces a rollback.execute
in interface Transaction
T
- result typestoreName
- data store namecallable
- transactional code in the form of Transaction.Callable
public void execute(Transaction.Runnable runnable)
Transaction
execute
in interface Transaction
Transaction.execute(String, Runnable)
public void execute(java.lang.String storeName, Transaction.Runnable runnable)
Transaction
RuntimeException
thrown in the transactional code enforces a rollback.execute
in interface Transaction
storeName
- data store namerunnable
- transactional code in the form of Runnable
public void commit()
Transaction
commit
in interface Transaction
public void commitRetaining()
Transaction
commitRetaining
in interface Transaction
public void end()
Transaction
Transaction tx = ...
try {
...
tx.commit();
} finally {
tx.end();
}
In case of successful commit this method does nothing. Otherwise it rollbacks the current transaction.end
in interface Transaction
public void close()
close
in interface Transaction
close
in interface java.lang.AutoCloseable