org.firebirdsql.pool
Class AbstractConnectionPool

java.lang.Object
  extended by org.firebirdsql.ds.RootCommonDataSource
      extended by org.firebirdsql.pool.AbstractConnectionPool
All Implemented Interfaces:
javax.sql.CommonDataSource, PooledObjectListener
Direct Known Subclasses:
BasicAbstractConnectionPool

Deprecated.

@Deprecated
public abstract class AbstractConnectionPool
extends RootCommonDataSource
implements PooledObjectListener

Abstract class for creating connection pools. Subclasses must implement factory method to produce physical connections to the database (method getConnectionManager() and few utility methods (getLogger() and getPoolName()).

Author:
Roman Rokytskyy

Nested Class Summary
protected static class AbstractConnectionPool.UserPasswordPair
          Deprecated. Structure class to store user name and password.
 
Constructor Summary
protected AbstractConnectionPool()
          Deprecated. Create instance of this class.
 
Method Summary
protected  void finalize()
          Deprecated. Shutdown pool if object is garbage collected.
abstract  ConnectionPoolConfiguration getConfiguration()
          Deprecated. Get configuration of this data source.
protected abstract  PooledConnectionManager getConnectionManager()
          Deprecated. Get instance of PooledConnectionManager responsible for instantiating pooled connections.
abstract  int getFreeSize()
          Deprecated. Get number of free connections in this pool.
protected abstract  org.firebirdsql.logging.Logger getLogger()
          Deprecated. Get logger for this instance.
protected  PooledObject getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue)
          Deprecated. Get pooled connection.
protected abstract  java.lang.String getPoolName()
          Deprecated. Get name of the pool.
 org.firebirdsql.pool.PooledConnectionQueue getQueue(java.lang.Object key)
          Deprecated. Get queue for the specified user name and password.
abstract  int getTotalSize()
          Deprecated. Get total size of physical connections opened to the database.
abstract  int getWorkingSize()
          Deprecated. Get number of connections that are in use.
protected  void physicalConnectionDeallocated(PooledObjectEvent event)
          Deprecated. Notify about the deallocation of the physical connection (for example, when connection is removed by the idle remover thread).
 void pooledObjectReleased(PooledObjectEvent event)
          Deprecated. Notify about new available connection.
 void restart()
          Deprecated. Restart this JDBC pool.
 void shutdown()
          Deprecated. Shutdown this JDBC pool.
 
Methods inherited from class org.firebirdsql.ds.RootCommonDataSource
getLogWriter, getParentLogger, setLogWriter
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, setLoginTimeout
 

Constructor Detail

AbstractConnectionPool

protected AbstractConnectionPool()
Deprecated. 
Create instance of this class.

Method Detail

getLogger

protected abstract org.firebirdsql.logging.Logger getLogger()
Deprecated. 
Get logger for this instance. By default all log messages belong to this class. Subclasses can override this behavior.

Returns:
instance of Logger.

finalize

protected void finalize()
                 throws java.lang.Throwable
Deprecated. 
Shutdown pool if object is garbage collected.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - if something bad happened.

restart

public void restart()
Deprecated. 
Restart this JDBC pool. This method restarts all JDBC connections.


shutdown

public void shutdown()
Deprecated. 
Shutdown this JDBC pool. This method closes all JDBC connections and marks pool as shut down.


getQueue

public org.firebirdsql.pool.PooledConnectionQueue getQueue(java.lang.Object key)
                                                    throws java.sql.SQLException
Deprecated. 
Get queue for the specified user name and password.

Parameters:
key - key identifying pool.
Returns:
instance of PooledConnectionQueue.
Throws:
java.sql.SQLException - if something went wrong.

getPooledConnection

protected PooledObject getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue)
                                    throws java.sql.SQLException
Deprecated. 
Get pooled connection. This method will block until there will be free connection to return.

Parameters:
queue - instance of PooledConnectionQueue where connection will be obtained.
Returns:
instance of PooledObject.
Throws:
java.sql.SQLException - if pooled connection cannot be obtained.

pooledObjectReleased

public void pooledObjectReleased(PooledObjectEvent event)
Deprecated. 
Notify about new available connection. This method is called by PooledConnection when its wrapped connection being closed.

Specified by:
pooledObjectReleased in interface PooledObjectListener
Parameters:
event - instance of PooledObjectEvent containing information about closed connection.

physicalConnectionDeallocated

protected void physicalConnectionDeallocated(PooledObjectEvent event)
Deprecated. 
Notify about the deallocation of the physical connection (for example, when connection is removed by the idle remover thread).

Parameters:
event - instance of PooledObjectEvent.

getConfiguration

public abstract ConnectionPoolConfiguration getConfiguration()
Deprecated. 
Get configuration of this data source.

Returns:
instance of ConnectionPoolConfiguration describing this data source.

getConnectionManager

protected abstract PooledConnectionManager getConnectionManager()
                                                         throws java.sql.SQLException
Deprecated. 
Get instance of PooledConnectionManager responsible for instantiating pooled connections.

Returns:
instance of PooledConnectionManager
Throws:
java.sql.SQLException - if connection manager cannot be obtained.

getPoolName

protected abstract java.lang.String getPoolName()
Deprecated. 
Get name of the pool. This name will be displayed in log when pool is started.

Returns:
name of the connection queue.

getFreeSize

public abstract int getFreeSize()
                         throws java.sql.SQLException
Deprecated. 
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.

Returns:
number of free connections left.
Throws:
java.sql.SQLException

getTotalSize

public abstract int getTotalSize()
                          throws java.sql.SQLException
Deprecated. 
Get total size of physical connections opened to the database.

Returns:
total number of opened connections to the database.
Throws:
java.sql.SQLException

getWorkingSize

public abstract int getWorkingSize()
                            throws java.sql.SQLException
Deprecated. 
Get number of connections that are in use.

Returns:
number of working connections.
Throws:
java.sql.SQLException


Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.