public class SpringHostConnectionAccessor extends Object implements HostConnectionAccessor
Modifier and Type | Class and Description |
---|---|
static interface |
SpringHostConnectionAccessor.ConnectionProvider
Host specific implementation.
|
Constructor and Description |
---|
SpringHostConnectionAccessor(SpringHostConnectionAccessor.ConnectionProvider connectionProvider,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
<A> A |
execute(boolean readOnly,
boolean newTransaction,
ConnectionCallback<A> callback)
Execute a callback which is supplied a
Connection , within a transaction. |
com.atlassian.fugue.Option<String> |
getSchemaName()
Returns the configured schema name (if any), for connections provided during
HostConnectionAccessor.execute(boolean, boolean, ConnectionCallback) |
public SpringHostConnectionAccessor(@Nonnull SpringHostConnectionAccessor.ConnectionProvider connectionProvider, @Nonnull org.springframework.transaction.PlatformTransactionManager transactionManager)
public <A> A execute(boolean readOnly, boolean newTransaction, @Nonnull ConnectionCallback<A> callback)
HostConnectionAccessor
Connection
, within a transaction.
It is up to the host as to whether it attempts to participate in an existing transaction. This is explicitly
explained to the consumer in TransactionalExecutor
.
The host must ensure that the Connection provided to the ConnectionCallback has autoCommit=false
.
Connection.commit()
or Connection.rollback()
will be called immediately prior
to return.
The following methods are guaranteed not to be called on connection
:
Connection.setAutoCommit(boolean)
Connection.commit()
Connection.close()
Connection.rollback()
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 HostConnectionAccessor
readOnly
- connection
should be read onlynewTransaction
- attempt to create a new transaction even if there is already a "current" transactioncallback
- mandatorycallback
@Nonnull public com.atlassian.fugue.Option<String> getSchemaName()
HostConnectionAccessor
HostConnectionAccessor.execute(boolean, boolean, ConnectionCallback)
getSchemaName
in interface HostConnectionAccessor
Copyright © 2015 Atlassian. All rights reserved.