public class DefaultTransactionalExecutor extends Object implements TransactionalExecutor
HostConnectionAccessor.
Created by DefaultTransactionalExecutorFactory| Constructor and Description |
|---|
DefaultTransactionalExecutor(HostConnectionAccessor hostConnectionAccessor,
boolean readOnly,
boolean newTransaction) |
| Modifier and Type | Method and Description |
|---|---|
<A> A |
execute(ConnectionCallback<A> callback)
Execute a callback which is supplied a
Connection, within a transaction. |
TransactionalExecutor |
existingTransaction()
Alter this executor so that the connection executes within an existing transaction or creates a new one if one is
not present
|
TransactionalExecutor |
newTransaction()
Alter this executor so that it executes in a new transaction, regardless of any existing
|
TransactionalExecutor |
readOnly()
Alter this executor so that the connection is read-only
|
TransactionalExecutor |
readWrite()
Alter this executor so that the connection is read-write
|
public DefaultTransactionalExecutor(@Nonnull HostConnectionAccessor hostConnectionAccessor, boolean readOnly, boolean newTransaction)
public <A> A execute(@Nonnull ConnectionCallback<A> callback)
TransactionalExecutorConnection, within a transaction.
After successful execution, the transaction will be committed. If the transaction is within the scope of a larger
transaction i.e. requiresNew has been set, it will be scheduled for commit, pending successful
completion of the target transaction.
If any exception is thrown by callback, the transaction will be immediately rolled back.
Do not attempt to retain or reuse the Connection outside of the scope of callback or within a
different thread. Connection is usually not considered thread safe.
A UnsupportedOperationException will be thrown on invoking any of the following:
Connection.setAutoCommit(boolean)Connection.commit()Connection.close()Connection.rollback()Connection.setReadOnly(boolean)Connection.setReadOnly(boolean)Connection.abort(java.util.concurrent.Executor)Connection.setCatalog(String)Connection.setSchema(String)Connection.setTransactionIsolation(int)Connection.setNetworkTimeout(java.util.concurrent.Executor, int)execute in interface TransactionalExecutorcallback - mandatory, may return Voidcallback@Nonnull public TransactionalExecutor readOnly()
TransactionalExecutorreadOnly in interface TransactionalExecutor@Nonnull public TransactionalExecutor readWrite()
TransactionalExecutorreadWrite in interface TransactionalExecutor@Nonnull public TransactionalExecutor newTransaction()
TransactionalExecutornewTransaction in interface TransactionalExecutor@Nonnull public TransactionalExecutor existingTransaction()
TransactionalExecutorexistingTransaction in interface TransactionalExecutorCopyright © 2015 Atlassian. All rights reserved.