|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.lib.sql.DefaultConnectionPool
public class DefaultConnectionPool
For internal connectiones, i.e. Connection information supplies in the Stylesheet. The Default Connection Pool will be used.
Field Summary | |
---|---|
private static boolean |
DEBUG
|
private java.util.Properties |
m_ConnectionProtocol
Always implement the properties mechinism, if the Password or Username is set seperatly then we will add them to the property manually. |
private java.lang.String |
m_driver
The basic information to make a JDBC Connection |
private java.sql.Driver |
m_Driver
A placeholder thast will keep the driver loaded between calls. |
private boolean |
m_IsActive
Are we active ?? |
private java.util.Vector |
m_pool
Storage for the PooledConnections |
private int |
m_PoolMinSize
The mimimum size of the connection pool, if the number of available connections falls below this mark, min connections will be allocated. |
private java.lang.String |
m_url
|
Constructor Summary | |
---|---|
DefaultConnectionPool()
|
Method Summary | |
---|---|
private void |
addConnection(PooledConnection value)
|
private java.sql.Connection |
createConnection()
|
protected void |
finalize()
|
void |
freeUnused()
Go through the connection pool and release any connections that are not InUse; |
java.sql.Connection |
getConnection()
Retrive a database 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)
Return a connection to the pool, the connection may be closed if the pool is inactive or has exceeded the max number of free connections |
void |
releaseConnectionOnError(java.sql.Connection con)
Provide a mechinism to return a connection to the pool on Error. |
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 |
setPoolEnabled(boolean flag)
The Pool can be Enabled and Disabled. |
void |
setProtocol(java.util.Properties p)
The Protocol string is used to pass in other connection 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 |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.sql.Driver m_Driver
private static final boolean DEBUG
private java.lang.String m_driver
private java.lang.String m_url
private int m_PoolMinSize
private java.util.Properties m_ConnectionProtocol
private java.util.Vector m_pool
private boolean m_IsActive
Constructor Detail |
---|
public DefaultConnectionPool()
Method Detail |
---|
public boolean isEnabled()
isEnabled
in interface ConnectionPool
public void setDriver(java.lang.String d)
setDriver
in interface ConnectionPool
d
- public void setURL(java.lang.String url)
setURL
in interface ConnectionPool
url
- public void freeUnused()
freeUnused
in interface ConnectionPool
public boolean hasActiveConnections()
hasActiveConnections
in interface ConnectionPool
public void setPassword(java.lang.String p)
setPassword
in interface ConnectionPool
p
- public void setUser(java.lang.String u)
setUser
in interface ConnectionPool
u
- public void setProtocol(java.util.Properties p)
setProtocol
in interface ConnectionPool
p
- public void setMinConnections(int n)
setMinConnections
in interface ConnectionPool
n
- public boolean testConnection()
testConnection
in interface ConnectionPool
public java.sql.Connection getConnection() throws java.lang.IllegalArgumentException, java.sql.SQLException
ConnectionPool
getConnection
in interface ConnectionPool
java.sql.SQLException
java.lang.IllegalArgumentException
public void releaseConnection(java.sql.Connection con) throws java.sql.SQLException
ConnectionPool
releaseConnection
in interface ConnectionPool
con
-
java.sql.SQLException
public void releaseConnectionOnError(java.sql.Connection con) throws java.sql.SQLException
ConnectionPool
releaseConnectionOnError
in interface ConnectionPool
con
-
java.sql.SQLException
private java.sql.Connection createConnection() throws java.sql.SQLException
java.sql.SQLException
public void initializePool() throws java.lang.IllegalArgumentException, java.sql.SQLException
java.lang.IllegalArgumentException
java.sql.SQLException
private void addConnection(PooledConnection value)
value
- protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setPoolEnabled(boolean flag)
setPoolEnabled
in interface ConnectionPool
flag
- Control the Connection Pool.
If it is enabled then Connections will actuall be held
around. If disabled then all unused connections will be instantly
closed and as connections are released they are closed and removed
from the pool.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |