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)
Transactionexecute in interface TransactionTransaction.execute(String, Callable)public <T> T execute(java.lang.String storeName,
Transaction.Callable<T> callable)
TransactionRuntimeException thrown in the transactional code enforces a rollback.execute in interface TransactionT - result typestoreName - data store namecallable - transactional code in the form of Transaction.Callablepublic void execute(Transaction.Runnable runnable)
Transactionexecute in interface TransactionTransaction.execute(String, Runnable)public void execute(java.lang.String storeName,
Transaction.Runnable runnable)
TransactionRuntimeException thrown in the transactional code enforces a rollback.execute in interface TransactionstoreName - data store namerunnable - transactional code in the form of Runnablepublic void commit()
Transactioncommit in interface Transactionpublic void commitRetaining()
TransactioncommitRetaining in interface Transactionpublic 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 Transactionpublic void close()
close in interface Transactionclose in interface java.lang.AutoCloseable