org.apache.xalan.lib.sql
Class DefaultConnectionPool

java.lang.Object
  |
  +--org.apache.xalan.lib.sql.DefaultConnectionPool

public class DefaultConnectionPool
extends java.lang.Object
implements ConnectionPool

The default connection pool was implemented so that all connection to JDBC data sources use connection pools.

The Default connection pool can also be used be external programs that want to use Xalan but don't already have connection pool code. Note however that this implementation of a connection pool is the bare minimum.


Constructor Summary
DefaultConnectionPool()
           
 
Method Summary
 void disablePool()
          The call provides a external method to control the connection pooling.
 void enablePool()
          The call provides a external method to control the connection pooling.
 void freeUnused()
          Go through the connection pool and release any connections that are not InUse;
 java.sql.Connection getConnection()
          Retrives an available connection from the pool.
 boolean hasActiveConnections()
          Is our ConnectionPool have any connections that are still in Use ??
 void initializePool()
           
 boolean isEnabled()
          Return our current Active state
 void releaseConnection(java.sql.Connection con)
           
 void setDriver(java.lang.String d)
          Set the driver call to be used to create connections
 void setMinConnections(int n)
          Override the current number of connections to keep in the pool.
 void setPassword(java.lang.String p)
          Set the password in the property set.
 void setProtocol(java.util.Properties p)
          Copy the properties from the source to our properties
 void setURL(java.lang.String url)
          Set the url used to connect to the database
 void setUser(java.lang.String u)
          Set the user name in the property set
 boolean testConnection()
          Try to aquire a new connection, if it succeeds then return true, else return false.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConnectionPool

public DefaultConnectionPool()
Method Detail

disablePool

public void disablePool()
The call provides a external method to control the connection pooling. If the pool is disabled, then the number of connections in use will be the number of connections in the pool. i.e. there will be no free unused connections.
Specified by:
disablePool in interface ConnectionPool

enablePool

public void enablePool()
The call provides a external method to control the connection pooling. If the pool is disabled, then the number of connections in use will be the number of connections in the pool. i.e. there will be no free unused connections.
Specified by:
enablePool in interface ConnectionPool

isEnabled

public boolean isEnabled()
Return our current Active state
Specified by:
isEnabled in interface ConnectionPool

setDriver

public void setDriver(java.lang.String d)
Set the driver call to be used to create connections
Specified by:
setDriver in interface ConnectionPool
Parameters:
Sting - d - The name of the driver to be used.

setURL

public void setURL(java.lang.String url)
Set the url used to connect to the database
Specified by:
setURL in interface ConnectionPool

freeUnused

public void freeUnused()
Go through the connection pool and release any connections that are not InUse;
Specified by:
freeUnused in interface ConnectionPool

hasActiveConnections

public boolean hasActiveConnections()
Is our ConnectionPool have any connections that are still in Use ??
Specified by:
hasActiveConnections in interface ConnectionPool

setPassword

public void setPassword(java.lang.String p)
Set the password in the property set.
Specified by:
setPassword in interface ConnectionPool

setUser

public void setUser(java.lang.String u)
Set the user name in the property set
Specified by:
setUser in interface ConnectionPool

setProtocol

public void setProtocol(java.util.Properties p)
Copy the properties from the source to our properties
Specified by:
setProtocol in interface ConnectionPool

setMinConnections

public void setMinConnections(int n)
Override the current number of connections to keep in the pool. This setting will only have effect on a new pool or when a new connection is requested and there is less connections that this setting.
Specified by:
setMinConnections in interface ConnectionPool

testConnection

public boolean testConnection()
Try to aquire a new connection, if it succeeds then return true, else return false. Note: This method will cause the connection pool to be built.
Specified by:
testConnection in interface ConnectionPool

getConnection

public java.sql.Connection getConnection()
                                  throws java.lang.IllegalArgumentException,
                                         java.sql.SQLException
Retrives an available connection from the pool. If one does not exist, the creat a new one.
Specified by:
getConnection in interface ConnectionPool
Throws:
java.sql.SQLException -  
IllegalArgumentException, - If connection info is invalid

releaseConnection

public void releaseConnection(java.sql.Connection con)
                       throws java.sql.SQLException
Specified by:
releaseConnection in interface ConnectionPool

initializePool

public void initializePool()
                    throws java.lang.IllegalArgumentException,
                           java.sql.SQLException


Copyright © 2000 Apache XML Project. All Rights Reserved.