|
||||||||||
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
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 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 String |
m_driver
The basic information to make a JDBC Connection |
private Object |
m_Driver
A placeholder thast will keep the driver loaded between calls. |
private boolean |
m_IsActive
Are we active ?? |
private 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 String |
m_url
|
Constructor Summary | |
DefaultConnectionPool()
|
Method Summary | |
private void |
addConnection(PooledConnection value)
|
private Connection |
createConnection()
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
void |
freeUnused()
Go through the connection pool and release any connections that are not InUse; |
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(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(Connection con)
Provide a mechinism to return a connection to the pool on Error. |
void |
setDriver(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(String p)
Set the password in the property set. |
void |
setPoolEnabled(boolean flag)
The Pool can be Enabled and Disabled. |
void |
setProtocol(Properties p)
The Protocol string is used to pass in other connection properties. |
void |
setURL(String url)
Set the url used to connect to the database |
void |
setUser(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 Object m_Driver
private static final boolean DEBUG
private String m_driver
private String m_url
private int m_PoolMinSize
private Properties m_ConnectionProtocol
private Vector m_pool
private boolean m_IsActive
Constructor Detail |
public DefaultConnectionPool()
Method Detail |
public boolean isEnabled()
isEnabled
in interface ConnectionPool
public void setDriver(String d)
setDriver
in interface ConnectionPool
d
-
public void setURL(String url)
setURL
in interface ConnectionPool
url
-
public void freeUnused()
freeUnused
in interface ConnectionPool
public boolean hasActiveConnections()
hasActiveConnections
in interface ConnectionPool
public void setPassword(String p)
setPassword
in interface ConnectionPool
p
-
public void setUser(String u)
setUser
in interface ConnectionPool
u
-
public void setProtocol(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 Connection getConnection() throws IllegalArgumentException, SQLException
ConnectionPool
getConnection
in interface ConnectionPool
SQLException
IllegalArgumentException
public void releaseConnection(Connection con) throws SQLException
ConnectionPool
releaseConnection
in interface ConnectionPool
con
-
SQLException
public void releaseConnectionOnError(Connection con) throws SQLException
ConnectionPool
releaseConnectionOnError
in interface ConnectionPool
con
-
SQLException
private Connection createConnection() throws SQLException
SQLException
public void initializePool() throws IllegalArgumentException, SQLException
IllegalArgumentException
SQLException
private void addConnection(PooledConnection value)
value
-
protected void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.
The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.
The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.
After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.
The finalize method is never invoked more than once by a Java virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize
in class Object
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 |