org.apache.commons.dbcp
Class AbandonedObjectPool

java.lang.Object
  extended by GenericObjectPool
      extended by org.apache.commons.dbcp.AbandonedObjectPool

public class AbandonedObjectPool
extends GenericObjectPool

An implementation of a Jakarta-Commons ObjectPool which tracks JDBC connections and can recover abandoned db connections. If logAbandoned=true, a stack trace will be printed for any abandoned db connections recovered.

Version:
$Revision: 899987 $ $Date: 2010-01-16 11:51:16 -0500 (Sat, 16 Jan 2010) $
Author:
Glenn L. Nielsen

Constructor Summary
AbandonedObjectPool(PoolableObjectFactory factory, AbandonedConfig config)
          Create an ObjectPool which tracks db connections.
 
Method Summary
 java.lang.Object borrowObject()
          Get a db connection from the pool.
 void invalidateObject(java.lang.Object obj)
          Invalidates an object from the pool.
 void returnObject(java.lang.Object obj)
          Return a db connection to the pool.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbandonedObjectPool

public AbandonedObjectPool(PoolableObjectFactory factory,
                           AbandonedConfig config)
Create an ObjectPool which tracks db connections.

Parameters:
factory - PoolableObjectFactory used to create this
config - configuration for abandoned db connections
Method Detail

borrowObject

public java.lang.Object borrowObject()
                              throws java.lang.Exception
Get a db connection from the pool. If removeAbandoned=true, recovers db connections which have been idle > removeAbandonedTimeout and getNumActive() > getMaxActive() - 3 and getNumIdle() < 2

Returns:
Object jdbc Connection
Throws:
java.lang.Exception - if an exception occurs retrieving a connection from the pool

invalidateObject

public void invalidateObject(java.lang.Object obj)
                      throws java.lang.Exception
Invalidates an object from the pool.

Parameters:
obj - object to be returned
Throws:
java.lang.Exception - if an exception occurs invalidating the object

returnObject

public void returnObject(java.lang.Object obj)
                  throws java.lang.Exception
Return a db connection to the pool.

Parameters:
obj - db Connection to return
Throws:
java.lang.Exception - if an exception occurs returning the connection to the pool


Copyright © 2001-2004 Apache Software Foundation. Documenation generated July 22 2013.