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 Details

    • execute

      @Deprecated <T> T execute(Environment environment, @Nonnull QueryCallback<T> callback)
      Deprecated.
      Use execute(Environment, DatabaseInstance, QueryCallback) instead. For now this will hit the 'configRDS' instance
      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 connection
      callback - the callback to invoke with a managed connection.
      Returns:
      The object from the callback
    • executeWithRetry

      <T> T executeWithRetry(Environment environment, @Nonnull QueryCallback<T> callback)
      Same as execute(Environment, QueryCallback), but will retry execution after rollback() with a delay several times if a QueryException is received.
      Type Parameters:
      T - The type of object this callback will return.
      Parameters:
      environment - the environment for which to create a connection
      callback - 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 connection
      instance - the database instance to query
      callback - 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 connection
      instance - the database instance to query
      callback - the callback to invoke with a managed connection.
      Returns:
      The object from the callback