Package com.codebarrel.data.api
Interface DbConnectionManager
- All Known Implementing Classes:
JiraDbConnectionManager
public interface DbConnectionManager
Manages data store connections (usually a pool) and provides
methods to execute a query.
-
Method Summary
Modifier and TypeMethodDescription<T> Texecute(Environment environment, DatabaseInstance instance, QueryCallback<T> callback) Executes the provided callback, by supplying it with a datastore connection.<T> Texecute(Environment environment, QueryCallback<T> callback) Deprecated.<T> TexecuteReadOnly(Environment environment, DatabaseInstance instance, QueryCallback<T> callback) Executes the provided callback, by supplying it with a datastore connection to a READ ONLY database.<T> TexecuteWithRetry(Environment environment, QueryCallback<T> callback) Same asexecute(Environment, QueryCallback), but will retry execution after rollback() with a delay several times if aQueryExceptionis received.
-
Method Details
-
execute
Deprecated.Useexecute(Environment, DatabaseInstance, QueryCallback)instead. For now this will hit the 'configRDS' instanceExecutes the provided callback, by supplying it with a datastore connection. Implementations need to manage the connection being used, taking care to return it to pool being used etc.- Type Parameters:
T- The type of object this callback will return.- Parameters:
environment- the environment for which to create a connectioncallback- the callback to invoke with a managed connection.- Returns:
- The object from the callback
-
executeWithRetry
Same asexecute(Environment, QueryCallback), but will retry execution after rollback() with a delay several times if aQueryExceptionis received.- Type Parameters:
T- The type of object this callback will return.- Parameters:
environment- the environment for which to create a connectioncallback- the callback to invoke with a managed connection.- Returns:
- The object from the callback
-
execute
<T> T execute(Environment environment, DatabaseInstance instance, @Nonnull QueryCallback<T> callback) Executes the provided callback, by supplying it with a datastore connection. Implementations need to manage the connection being used, taking care to return it to pool being used etc.- Type Parameters:
T- The type of object this callback will return.- Parameters:
environment- the environment for which to create a connectioninstance- the database instance to querycallback- the callback to invoke with a managed connection.- Returns:
- The object from the callback
-
executeReadOnly
<T> T executeReadOnly(Environment environment, DatabaseInstance instance, @Nonnull QueryCallback<T> callback) Executes the provided callback, by supplying it with a datastore connection to a READ ONLY database. Implementations need to manage the connection being used, taking care to return it to pool being used etc.- Type Parameters:
T- The type of object this callback will return.- Parameters:
environment- the environment for which to create a connectioninstance- the database instance to querycallback- the callback to invoke with a managed connection.- Returns:
- The object from the callback
-
execute(Environment, DatabaseInstance, QueryCallback)instead.