Keel 2.1RC2

org.apache.avalon.excalibur.datasource
Class JdbcConnectionPool

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.excalibur.pool.AbstractPool
          extended byorg.apache.avalon.excalibur.pool.DefaultPool
              extended byorg.apache.avalon.excalibur.pool.SoftResourceLimitingPool
                  extended byorg.apache.avalon.excalibur.pool.HardResourceLimitingPool
                      extended byorg.apache.avalon.excalibur.datasource.JdbcConnectionPool
All Implemented Interfaces:
Disposable, Initializable, LogEnabled, Pool, Resizable, java.lang.Runnable, ThreadSafe

public class JdbcConnectionPool
extends HardResourceLimitingPool
implements java.lang.Runnable, Disposable, Initializable

The Pool implementation for JdbcConnections. It uses a background thread to manage the number of SQL Connections.

Since:
4.0
Version:
CVS $Revision: 1.5 $ $Date: 2004/04/02 11:08:12 $
Author:

Field Summary
private  boolean m_autoCommit
           
private  java.lang.Exception m_cause
           
private  java.lang.Thread m_initThread
           
private  boolean m_noConnections
           
private  java.lang.Object m_spinLock
           
private  long m_wait
           
 
Fields inherited from class org.apache.avalon.excalibur.pool.DefaultPool
m_controller, m_disposed, m_max, m_min, m_quickFail
 
Fields inherited from class org.apache.avalon.excalibur.pool.AbstractPool
DEFAULT_POOL_SIZE, m_active, m_factory, m_initialized, m_mutex, m_ready
 
Fields inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
 
Constructor Summary
JdbcConnectionPool(JdbcConnectionFactory factory, DefaultPoolController controller, int min, int max, boolean autoCommit)
           
 
Method Summary
 Poolable get()
           
 void initialize()
          Initialize the component.
protected  Poolable newPoolable()
          This is the method to override when you need to enforce creational policies.
 void put(Poolable obj)
           
 void run()
           
 void setTimeout(long timeout)
          Set the timeout in milliseconds for blocking when waiting for a new connection.
 
Methods inherited from class org.apache.avalon.excalibur.pool.HardResourceLimitingPool
internalGrow
 
Methods inherited from class org.apache.avalon.excalibur.pool.SoftResourceLimitingPool
grow, shrink
 
Methods inherited from class org.apache.avalon.excalibur.pool.DefaultPool
dispose
 
Methods inherited from class org.apache.avalon.excalibur.pool.AbstractPool
internalShrink, lock, removePoolable, size, unlock
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.framework.activity.Disposable
dispose
 

Field Detail

m_cause

private java.lang.Exception m_cause

m_initThread

private java.lang.Thread m_initThread

m_autoCommit

private final boolean m_autoCommit

m_noConnections

private boolean m_noConnections

m_wait

private long m_wait

m_spinLock

private java.lang.Object m_spinLock
Constructor Detail

JdbcConnectionPool

public JdbcConnectionPool(JdbcConnectionFactory factory,
                          DefaultPoolController controller,
                          int min,
                          int max,
                          boolean autoCommit)
                   throws java.lang.Exception
Method Detail

setTimeout

public void setTimeout(long timeout)
Set the timeout in milliseconds for blocking when waiting for a new connection. It defaults to -1. Any number below 1 means that there is no blocking, and the Pool fails hard. Any number above 0 means we will wait for that length of time before failing.


initialize

public void initialize()
Description copied from interface: Initializable
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class HardResourceLimitingPool

newPoolable

protected final Poolable newPoolable()
                              throws java.lang.Exception
Description copied from class: AbstractPool
This is the method to override when you need to enforce creational policies.

Overrides:
newPoolable in class HardResourceLimitingPool
Throws:
java.lang.Exception

get

public Poolable get()
             throws java.lang.Exception
Specified by:
get in interface Pool
Overrides:
get in class DefaultPool
Throws:
java.lang.Exception

put

public void put(Poolable obj)
Specified by:
put in interface Pool
Overrides:
put in class DefaultPool

run

public void run()
Specified by:
run in interface java.lang.Runnable

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.