## org.firebirdsql.pool
Class AbstractDriverConnectionPoolDataSource

    java.lang.Object
      org.firebirdsql.pool.AbstractConnectionPool
          org.firebirdsql.pool.BasicAbstractConnectionPool
              org.firebirdsql.pool.AbstractDriverConnectionPoolDataSource

All Implemented Interfaces:
  Serializable, EventListener, Referenceable, CommonDataSource, ConnectionEventListener, ConnectionPoolDataSource, ConnectionPoolConfiguration, PooledConnectionEventListener, PooledObjectListener

Direct Known Subclasses:
  DriverConnectionPoolDataSource

    public abstract class AbstractDriverConnectionPoolDataSource

extends BasicAbstractConnectionPool
implements ConnectionPoolDataSource, PooledConnectionEventListener

Generic implementation of `ConnectionPoolDataSource` that uses `DriverManager` to open physical connections to the database.

Author:
  Roman Rokytskyy
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.firebirdsql.pool.AbstractConnectionPool
`AbstractConnectionPool.UserPasswordPair`

Field Summary
`protected static String` `DRIVER_CLASS_NAME`
`static AbstractConnectionPool.UserPasswordPair` `EMPTY_USER_PASSWORD`
`protected static String` `JDBC_URL`
`protected static String` `PROPERTIES`

Constructor Summary
`AbstractDriverConnectionPoolDataSource()` Create instance of this class.

Method Summary
`void` `connectionClosed(ConnectionEvent connectionEvent)` Notify about connection being closed.
`void` `connectionErrorOccurred(ConnectionEvent event)` Notify about serious error when using the connection.
`protected BasicAbstractConnectionPool` `createObjectInstance()` Create instance of this data source.
`protected PooledConnectionManager` `getConnectionManager()` Get connection manager that will allocate physical connections to the database.
`Reference` `getDefaultReference()` Get default JNDI reference for this instance.
`String` `getDriverClassName()`
`int` `getFreeSize()` Get number of free connections in this pool.
`String` `getIsolation()`
`String` `getJdbcUrl()`
`protected Logger` `getLogger()` Get logger for this instance.
`int` `getLoginTimeout()` Get login timeout.
`PrintWriter` `getLogWriter()`
`PooledConnection` `getPooledConnection()` Get pooled connection.
`protected PooledObject` `getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue)` Get pooled connection from the pooled queue.
`PooledConnection` `getPooledConnection(String user, String password)` Get pooled connection for the specified user name and password.
`protected String` `getPoolName()` Get name of this connection pool.
`Properties` `getProperties()`
`String` `getProperty(String name)`
`int` `getTotalSize()` Get total size of physical connections opened to the database.
`int` `getTransactionIsolationLevel()`
`int` `getWorkingSize()` Get number of connections that are in use.
`void` `physicalConnectionClosed(ConnectionEvent connectionEvent)` Notify about physical connection being closed.
`void` `physicalConnectionDeallocated(ConnectionEvent connectionEvent)` Notify about the deallocation of the physical connection.
`protected Object` `processObjectInstance(AbstractDriverConnectionPoolDataSource ds, Object obj)`
`void` `setDriverClassName(String driverClassName)`
`void` `setIsolation(String isolation)`
`void` `setJdbcUrl(String jdbcUrl)`
`void` `setLoginTimeout(int seconds)` Set login timeout for new connection.
`void` `setLogWriter(PrintWriter out)`
`void` `setProperties(Properties properties)` Set JDBC properties that will be passed when opening a connection.
`void` `setProperty(String name, String value)`
`void` `setTransactionIsolationLevel(int transactionIsolation)`

Methods inherited from class org.firebirdsql.pool.BasicAbstractConnectionPool

`deserialize, getBlockingTimeout, getConfiguration, getIdleTimeout, getMaxConnections, getMaxIdleTime, getMaxPoolSize, getMaxStatements, getMinConnections, getMinPoolSize, getObjectInstance, getPingInterval, getPingStatement, getRefAddr, getReference, getRetryInterval, isKeepStatements, isPingable, isPooling, isStatementPooling, serialize, setBlockingTimeout, setIdleTimeout, setKeepStatements, setMaxConnections, setMaxIdleTime, setMaxPoolSize, setMaxStatements, setMinConnections, setMinPoolSize, setPingInterval, setPingStatement, setPooling, setReference, setRetryInterval, setStatementPooling`

Methods inherited from class org.firebirdsql.pool.AbstractConnectionPool
`finalize, getQueue, physicalConnectionDeallocated, pooledObjectReleased, restart, shutdown`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_USER_PASSWORD

    public static final AbstractConnectionPool.UserPasswordPair EMPTY_USER_PASSWORD

### PROPERTIES

    protected static final String PROPERTIES

See Also:
  Constant Field Values

### DRIVER_CLASS_NAME

    protected static final String DRIVER_CLASS_NAME

See Also:
  Constant Field Values

### JDBC_URL

    protected static final String JDBC_URL

See Also:
  Constant Field Values

Constructor Detail

### AbstractDriverConnectionPoolDataSource

    public AbstractDriverConnectionPoolDataSource()

  Create instance of this class.

Method Detail

### getJdbcUrl

    public String getJdbcUrl()

### setJdbcUrl

    public void setJdbcUrl(String jdbcUrl)

### getDriverClassName

    public String getDriverClassName()

### setDriverClassName

    public void setDriverClassName(String driverClassName)

### getProperty

    public String getProperty(String name)

### setProperty

    public void setProperty(String name,
                            String value)

### getProperties

    public Properties getProperties()

### setProperties

    public void setProperties(Properties properties)

  Set JDBC properties that will be passed when opening a connection.

  Parameters:
    `properties` - instance of `Properties` containing properties of a connection to open.
  See Also:
    `getProperties()`

### getLogger

    protected Logger getLogger()

  Description copied from class: `AbstractConnectionPool`
  Get logger for this instance. By default all log messages belong to this class. Subclasses can override this behavior.

  Specified by:
    `getLogger` in class `AbstractConnectionPool`
  Returns:
    instance of `Logger`.

### getLogWriter

    public PrintWriter getLogWriter()

  Specified by:
    `getLogWriter` in interface `CommonDataSource`
  Specified by:
    `getLogWriter` in class `BasicAbstractConnectionPool`

### setLogWriter

    public void setLogWriter(PrintWriter out)

  Specified by:
    `setLogWriter` in interface `CommonDataSource`
  Specified by:
    `setLogWriter` in class `BasicAbstractConnectionPool`

### getLoginTimeout

    public int getLoginTimeout()

  Get login timeout.

  Specified by:
    `getLoginTimeout` in interface `CommonDataSource`
  Specified by:
    `getLoginTimeout` in class `BasicAbstractConnectionPool`
  Returns:
    value set in `setLoginTimeout(int)` method or 0.

### setLoginTimeout

    public void setLoginTimeout(int seconds)

  Set login timeout for new connection. Currently ignored.

  Specified by:
    `setLoginTimeout` in interface `CommonDataSource`
  Specified by:
    `setLoginTimeout` in class `BasicAbstractConnectionPool`
  Parameters:
    `seconds` - how long pool should wait until new connection is granted.

### getTransactionIsolationLevel

    public int getTransactionIsolationLevel()

### setTransactionIsolationLevel

    public void setTransactionIsolationLevel(int transactionIsolation)

### getIsolation

    public String getIsolation()

### setIsolation

    public void setIsolation(String isolation)
                      throws SQLException

  Throws:
    `SQLException`

### getConnectionManager

    protected PooledConnectionManager getConnectionManager()
                                                    throws SQLException

  Get connection manager that will allocate physical connections to the database.

  Specified by:
    `getConnectionManager` in class `AbstractConnectionPool`
  Returns:
    instance of `PooledConnectionManager` class.
  Throws:
    `SQLException` - if connection manager cannot be obtained.

### getPoolName

    protected String getPoolName()

  Get name of this connection pool.

  Specified by:
    `getPoolName` in class `AbstractConnectionPool`
  Returns:
    name of the pool, equal to the JDBC URL value.

### getPooledConnection

    protected PooledObject getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue)
                                        throws SQLException

  Get pooled connection from the pooled queue.

  Overrides:
    `getPooledConnection` in class `AbstractConnectionPool`
  Parameters:
    `queue` - instance of `PooledConnectionQueue` where connection will be obtained.
  Returns:
    instance of `PooledObject`.
  Throws:
    `SQLException` - if pooled connection cannot be obtained.

### getPooledConnection

    public PooledConnection getPooledConnection()
                                         throws SQLException

  Get pooled connection. This method will block until there will be free connection to return.

  Specified by:
    `getPooledConnection` in interface `ConnectionPoolDataSource`
  Specified by:
    `getPooledConnection` in class `BasicAbstractConnectionPool`
  Returns:
    instance of `PooledConnection`.
  Throws:
    `SQLException` - if pooled connection cannot be obtained.

### getPooledConnection

    public PooledConnection getPooledConnection(String user,
                                                String password)
                                         throws SQLException

  Get pooled connection for the specified user name and password.

  Specified by:
    `getPooledConnection` in interface `ConnectionPoolDataSource`
  Specified by:
    `getPooledConnection` in class `BasicAbstractConnectionPool`
  Parameters:
    `user` - user name.
    `password` - password corresponding to specified user name.
  Returns:
    instance of `PooledConnection` for the specified credentials.
  Throws:
    `SQLException` - always, this method is not yet implemented.

### connectionClosed

    public void connectionClosed(ConnectionEvent connectionEvent)

  Notify about connection being closed.

  Specified by:
    `connectionClosed` in interface `ConnectionEventListener`
  Parameters:
    `connectionEvent` - instance of `ConnectionEvent`.

### physicalConnectionClosed

    public void physicalConnectionClosed(ConnectionEvent connectionEvent)

  Notify about physical connection being closed.

  Specified by:
    `physicalConnectionClosed` in interface `PooledConnectionEventListener`
  Parameters:
    `connectionEvent` - instance of `ConnectionEvent`.

### physicalConnectionDeallocated

    public void physicalConnectionDeallocated(ConnectionEvent connectionEvent)

  Notify about the deallocation of the physical connection.

  Specified by:
    `physicalConnectionDeallocated` in interface `PooledConnectionEventListener`
  Parameters:
    `connectionEvent` - instance of `ConnectionEvent`.

### connectionErrorOccurred

    public void connectionErrorOccurred(ConnectionEvent event)

  Notify about serious error when using the connection. Currently these events are ignored.

  Specified by:
    `connectionErrorOccurred` in interface `ConnectionEventListener`
  Parameters:
    `event` - instance of `ConnectionEvent` containing information about an error.

### getFreeSize

    public int getFreeSize()
                    throws SQLException

  Description copied from class: `AbstractConnectionPool`
  Get number of free connections in this pool. This method returns the number of free open connections to the specified database. It might return 0, but this does not mean that next request will block. This will happen only if `getMaxSize() != 0 && getMaxSize() == getWorkingSize()`, meaning that we have allocated maximum number of connections and all of them are in use.

  Specified by:
    `getFreeSize` in class `AbstractConnectionPool`
  Returns:
    number of free connections left.
  Throws:
    `SQLException`

### getTotalSize

    public int getTotalSize()
                     throws SQLException

  Description copied from class: `AbstractConnectionPool`
  Get total size of physical connections opened to the database.

  Specified by:
    `getTotalSize` in class `AbstractConnectionPool`
  Returns:
    total number of opened connections to the database.
  Throws:
    `SQLException`

### getWorkingSize

    public int getWorkingSize()
                       throws SQLException

  Description copied from class: `AbstractConnectionPool`
  Get number of connections that are in use.

  Specified by:
    `getWorkingSize` in class `AbstractConnectionPool`
  Returns:
    number of working connections.
  Throws:
    `SQLException`

### createObjectInstance

    protected BasicAbstractConnectionPool createObjectInstance()

  Create instance of this data source.

  Specified by:
    `createObjectInstance` in class `BasicAbstractConnectionPool`

### getDefaultReference

    public Reference getDefaultReference()

  Get default JNDI reference for this instance.

  Overrides:
    `getDefaultReference` in class `BasicAbstractConnectionPool`
  Returns:
    instance of `Reference` containing all information that allows to reconstruct the datasource.

### processObjectInstance

    protected Object processObjectInstance(AbstractDriverConnectionPoolDataSource ds,
                                           Object obj)
                                    throws Exception

  Throws:
    `Exception`

Copyright © 2001-2010. All Rights Reserved.