Class ConnectionPool<PC extends PooledConnection>

java.lang.Object
overit.geocall.sql.ConnectionPool<PC>
Direct Known Subclasses:
DataSourceConnectionPool, DumbConnectionPool, ElasticConnectionPool, StandardConnectionPool

public abstract class ConnectionPool<PC extends PooledConnection> extends Object
Abstract class that defines the functionality of a Connection Pool, that is a cache of database connections maintained so that the connections can be reused when future requests to the database are required.
Connection pools are used to enhance the performance of executing commands on a database.
  • Field Details

  • Constructor Details

    • ConnectionPool

      public ConnectionPool(String name)
      Creates a ConnectionPool with the specified name and parameters
      Parameters:
      name - The name of the ConnectionPool
  • Method Details

    • getCross

      public String getCross()
      Returns the cross
      Returns:
      The cross
    • setCross

      public void setCross(String cross)
      Sets the cross
      Parameters:
      cross - The cross
    • getEncryptionKey

      public String getEncryptionKey()
      Returns a String about the encryption key.
      Returns:
      a String about the encryption key.
    • setEncryptionKey

      public void setEncryptionKey(String encryptionKey)
      Sets the encryption key.
      Parameters:
      encryptionKey - String about the encryption key.
    • getQueryHistory

      public EventHistory getQueryHistory()
      Returns the EventHistory that contains the history of the query
      Returns:
      The history of the query
    • getHistory

      public EventHistory getHistory()
      Returns the EventHistory that contains the history
      Returns:
      The history
    • getName

      public String getName()
      Returns the name of the ConnectionPool
      Returns:
      The string that contains the name of the ConnectionPool
    • getDBObjectMap

      public DBObjectMap getDBObjectMap(@NotNull @NotNull DBType dbType)
      Returns the DBObjectMap, the map between Java objects in memory and SQL objects, used by this instance of ConnectionPool
      Returns:
      The DBObjectMap, the map between Java objects in memory and SQL objects, used by this instance of ConnectionPool
    • getParameters

      public StringGetter getParameters()
      Returns the StringGetter of the database parameters (for example the TABLESPACE names)
      Returns:
      The database parameters
    • getMaxQueryRows

      public MutableNumber getMaxQueryRows()
      Returns the maximum MutableNumber of rows that can be extracted by the query
      Returns:
      The maximum number of rows that can be extracted
    • getConnection

      public abstract PC getConnection(String activity) throws SQLException
      Extracts a Connection from the pool
      Parameters:
      activity - The motivation / operation for which the extract request originates
      Returns:
      The Connection extracted
      Throws:
      SQLException - If there is an error during the extraction, an SQLException will be raised
    • releaseConnection

      public abstract void releaseConnection(PC pc) throws SQLException
      Releases a Connection previously extracted with getConnection()
      Parameters:
      pc - The Connection to release
      Throws:
      SQLException - If there is an error during the release, an SQLException will be raised
    • getConnectionInfo

      public abstract List<PooledConnectionInfo> getConnectionInfo()
      Returns the informations about the connections of the pool
      Returns:
      The List that contains the informations about the connections
    • dispose

      public void dispose()
      Disposes the ConnectionPool. Use this method when the object is no longer needed, for example when the application is closed
    • locked

      public abstract int locked()
      Returns the number of locked connections, i.e. the connections that are currently used by the application
      Returns:
      The number of currently locked connections
    • size

      public abstract int size()
      Returns the size of the ConnectionPool
      Returns:
      The number of Connection of this instance of ConnectionPool
    • getDBType

      public DBType getDBType()
      Returns the DBType of the database.
      Returns:
      The DBType of the database.
    • setDBType

      public void setDBType(DBType dbType)
      Sets the DBType of the database.
      Parameters:
      dbType - The DBType of the database.