|
|||||||||
| Home >> All >> org >> apache >> xalan >> lib >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.xalan.lib.sql
Class DefaultConnectionPool

java.lang.Objectorg.apache.xalan.lib.sql.DefaultConnectionPool
- All Implemented Interfaces:
- ConnectionPool
- public class DefaultConnectionPool
- extends java.lang.Object
- implements ConnectionPool
- extends java.lang.Object
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()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. |
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 |
m_Driver
private java.sql.Driver m_Driver
- A placeholder thast will keep the driver loaded
between calls.
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
m_driver
private java.lang.String m_driver
- The basic information to make a JDBC Connection
m_url
private java.lang.String m_url
m_PoolMinSize
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. The Connection
Pool will always be somewhere between MinSize and MinSize*2
m_ConnectionProtocol
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.
m_pool
private java.util.Vector m_pool
- Storage for the PooledConnections
m_IsActive
private boolean m_IsActive
- Are we active ??
| Constructor Detail |
DefaultConnectionPool
public DefaultConnectionPool()
| Method Detail |
isEnabled
public boolean isEnabled()
- Return our current Active state
- Specified by:
isEnabledin interfaceConnectionPool
setDriver
public void setDriver(java.lang.String d)
- Set the driver call to be used to create connections
- Specified by:
setDriverin interfaceConnectionPool
setURL
public void setURL(java.lang.String url)
- Set the url used to connect to the database
- Specified by:
setURLin interfaceConnectionPool
freeUnused
public void freeUnused()
- Go through the connection pool and release any connections
that are not InUse;
- Specified by:
freeUnusedin interfaceConnectionPool
hasActiveConnections
public boolean hasActiveConnections()
- Is our ConnectionPool have any connections that are still in Use ??
- Specified by:
hasActiveConnectionsin interfaceConnectionPool
setPassword
public void setPassword(java.lang.String p)
- Set the password in the property set.
- Specified by:
setPasswordin interfaceConnectionPool
setUser
public void setUser(java.lang.String u)
- Set the user name in the property set
- Specified by:
setUserin interfaceConnectionPool
setProtocol
public void setProtocol(java.util.Properties p)
- The Protocol string is used to pass in other connection
properties. A properties file is a general purpose container
- Specified by:
setProtocolin interfaceConnectionPool
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:
setMinConnectionsin interfaceConnectionPool
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:
testConnectionin interfaceConnectionPool
getConnection
public java.sql.Connection getConnection() throws java.lang.IllegalArgumentException, java.sql.SQLException
- Description copied from interface:
ConnectionPool - Retrive a database connection from the pool
- Specified by:
getConnectionin interfaceConnectionPool
releaseConnection
public void releaseConnection(java.sql.Connection con) throws java.sql.SQLException
- Description copied from interface:
ConnectionPool - 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
- Specified by:
releaseConnectionin interfaceConnectionPool
releaseConnectionOnError
public void releaseConnectionOnError(java.sql.Connection con) throws java.sql.SQLException
- Description copied from interface:
ConnectionPool - Provide a mechinism to return a connection to the pool on Error.
A good default behaviour is to close this connection and build
a new one to replace it. Some JDBC impl's won't allow you to
reuse a connection after an error occurs.
- Specified by:
releaseConnectionOnErrorin interfaceConnectionPool
createConnection
private java.sql.Connection createConnection() throws java.sql.SQLException
initializePool
public void initializePool()
throws java.lang.IllegalArgumentException,
java.sql.SQLException
addConnection
private void addConnection(PooledConnection value)
finalize
protected void finalize()
throws java.lang.Throwable
- Description copied from class:
java.lang.Object - Called on an object by the Virtual Machine at most once,
at some point after the Object is determined unreachable
but before it is destroyed. You would think that this
means it eventually is called on every Object, but this is
not necessarily the case. If execution terminates
abnormally, garbage collection does not always happen.
Thus you cannot rely on this method to always work.
For finer control over garbage collection, use references
from the
java.lang.refpackage.Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply
super.finalize().finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.
If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.
It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.
Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls
super.finalize().The default implementation does nothing.
setPoolEnabled
public void setPoolEnabled(boolean flag)
- The Pool can be Enabled and Disabled. Disabling the pool
closes all the outstanding Unused connections and any new
connections will be closed upon release.
- Specified by:
setPoolEnabledin interfaceConnectionPool
|
|||||||||
| Home >> All >> org >> apache >> xalan >> lib >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.xalan.lib.sql.DefaultConnectionPool