ca.bc.gov.webade.dbpool
Class WebADEPooledConnection

java.lang.Object
  extended byca.bc.gov.webade.dbpool.WebADEPooledConnection
All Implemented Interfaces:
java.io.Serializable

public class WebADEPooledConnection
extends java.lang.Object
implements java.io.Serializable

Author:
jross
See Also:
Serialized Form

Constructor Summary
WebADEPooledConnection(ConnectionPoolParams params)
          Deprecated.  
WebADEPooledConnection(javax.sql.PooledConnection pooledConnection)
           
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener l)
          Adds the given listener to the list of listeners to this connection's events.
 void close()
          Closes the pooled connection.
 java.util.Date getCreatedTime()
           
 int getId()
           
 java.util.Date getLastClosedTime()
           
 java.util.Date getLastOpenedTime()
           
 javax.sql.PooledConnection getPooledConnection()
           
 long getTotalUsageTime()
           
 long getUsageCount()
           
 void incrementUsage()
          Increments the total usage count for this connection.
 boolean isAvailable()
           
 void releaseConnection()
          Releases the connection back to the pool.
 void removeConnectionEventListener(javax.sql.ConnectionEventListener l)
          Removes the given listener from the list of listeners to this connection's events.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebADEPooledConnection

public WebADEPooledConnection(javax.sql.PooledConnection pooledConnection)
Parameters:
pooledConnection - The pooled connection object to wrap.

WebADEPooledConnection

public WebADEPooledConnection(ConnectionPoolParams params)
                       throws java.sql.SQLException
Deprecated.  

Parameters:
params - The connection pool params with connection information create a connection with.
Throws:
java.sql.SQLException - Thrown if a connection could not be created.
Method Detail

addConnectionEventListener

public void addConnectionEventListener(javax.sql.ConnectionEventListener l)
Adds the given listener to the list of listeners to this connection's events.

Parameters:
l - The target listener

removeConnectionEventListener

public void removeConnectionEventListener(javax.sql.ConnectionEventListener l)
Removes the given listener from the list of listeners to this connection's events.

Parameters:
l - The target listener

incrementUsage

public void incrementUsage()
Increments the total usage count for this connection.


getCreatedTime

public java.util.Date getCreatedTime()
Returns:
The date this connection was created.

getLastOpenedTime

public java.util.Date getLastOpenedTime()
Returns:
The date the last time this connection was retrieved from the pool.

getLastClosedTime

public java.util.Date getLastClosedTime()
Returns:
The date the last time this connection was returned to the pool.

isAvailable

public boolean isAvailable()
Returns:
A flag indicating whether the pooled connection is available to be checked out.

getUsageCount

public long getUsageCount()
Returns:
The number of times this connection has been checked out of the pool since its creation.

getTotalUsageTime

public long getTotalUsageTime()
Returns:
The total time, in milliseconds, this connection has been checked out of the pool since its creation.

getPooledConnection

public javax.sql.PooledConnection getPooledConnection()
Returns:
The pooled connection.

releaseConnection

public void releaseConnection()
Releases the connection back to the pool.


getId

public int getId()
Returns:
The unique id of the pooled connection object.

close

public void close()
           throws java.sql.SQLException
Closes the pooled connection.

Throws:
java.sql.SQLException - Thrown if a error occurs while closing the connection to the database.