Class PooledConnection

java.lang.Object
overit.geocall.sql.PooledConnection
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
DataSourcePooledConnection, ElasticPooledConnection, StandardPooledConnection

public abstract class PooledConnection extends Object implements AutoCloseable
The class defines a connection that can be inserted into any implementation of ConnectionPool
  • Field Details

    • died

      protected boolean died
    • _connectionpool

      protected ConnectionPool _connectionpool
      Refers to the pool from which the connection was extracted. It can be null if it has not yet been extracted or if the pool to which it belongs has never been specified
    • _dbstatements

      protected ArrayList<DBStatement> _dbstatements
      Contains the list of DBStatement opened by the connection through the getDBStatement() method. This list is maintained in such a way that each release of the connection automatically closes the statements
  • Constructor Details

    • PooledConnection

      public PooledConnection()
  • Method Details

    • check

      protected void check()
    • unsupported

      protected static void unsupported()
    • isDied

      public boolean isDied()
    • getConnection

      public abstract Connection getConnection()
      Returns the JDBC connection used by the instance
      Returns:
      The JDBC connection
    • getPool

      public ConnectionPool getPool()
      Returns the connection pool from which the connection was extracted
      Returns:
      The connection pool from which the connection was extracted
    • getInfo

      public abstract PooledConnectionInfo getInfo()
      Returns some informations about the connection, such the last connection time, last release time, etc.
      Returns:
      The PooledConnectionInfo object that contains some informations about the connection
    • getMetadata

      public PooledConnection.Metadata getMetadata()
      Return PooledConnection.Metadata that can be used to retrieve information about DB tables and table-spaces
      Returns:
      the PooledConnection.Metadata instance based on the current db type
    • release

      public void release() throws SQLException
      Invoked by the application to make the release effective on the connection pool
      Throws:
      SQLException - The release of a connection to the instance can lead an opening or a closure, therefore it can raise an SQL exception
    • close

      public void close() throws SQLException
      Invoked by the application to make the release effective on the connection pool
      Specified by:
      close in interface AutoCloseable
      Throws:
      SQLException - The release of a connection to the instance can lead an opening or a closure, therefore it can raise an SQL exception
    • getDBStatement

      public DBStatement getDBStatement() throws SQLException
      Asks to the connection to instanciate a DBStatement
      Returns:
      A new instance of DBStatement. The connection can make the statement inherit the properties of the StandardPooledConnection
      Throws:
      SQLException - If the communication with the database throws an exception, that it is raised to the caller
    • releaseDBStatement

      public void releaseDBStatement(DBStatement dbs) throws SQLException
      Returns, for closing, a statement previously requested to the connection
      Parameters:
      dbs - The statement previously requested to the connection
      Throws:
      SQLException - The release of a connection lead to a closure, therefore it can raise an SQL exception
    • commit

      public void commit() throws SQLException
      Makes a commit on the connection
      Throws:
      SQLException - If the communication with the database throws an exception, that it is raised to the caller
    • rollback

      public void rollback() throws SQLException
      Makes a rollback on the connection
      Throws:
      SQLException - If the communication with the database throws an exception, that it is raised to the caller