public class ConnectionPool extends java.lang.Object implements TimerListener
构造器和说明 |
---|
ConnectionPool() |
限定符和类型 | 方法和说明 |
---|---|
void |
close(java.sql.Connection con)
Places the connection back into the connection pool,
or closes the connection if the maximum use count has
been reached
|
void |
destroy()
Destroys the pool and it's contents.
|
java.sql.Connection |
getConnection()
Gets an available JDBC Connection.
|
boolean |
initialize()
Initializes the ConnectionPool object using
'ConnectionPool.cfg' as the configuration file
|
boolean |
initialize(java.util.Properties poolProperties) |
boolean |
initialize(java.lang.String config)
Initializes the ConnectionPool object with the specified
configuration file
|
boolean |
initialize(java.lang.String config,
java.lang.String sector) |
void |
printPool()
Prints the contents of the connection pool to the
standard output device
|
void |
TimerEvent(java.lang.Object object)
Called by the timer each time a clock cycle expires.
|
public boolean initialize() throws java.lang.Exception
Initializes the ConnectionPool object using 'ConnectionPool.cfg' as the configuration file
java.lang.Exception
- Exceptionpublic boolean initialize(java.lang.String config) throws java.lang.Exception
Initializes the ConnectionPool object with the specified configuration file
config
- Configuration file namejava.lang.Exception
- Exceptionpublic boolean initialize(java.lang.String config, java.lang.String sector) throws java.lang.Exception
java.lang.Exception
public boolean initialize(java.util.Properties poolProperties) throws java.lang.Exception
java.lang.Exception
public void destroy()
Destroys the pool and it's contents. Closes any open JDBC connections and frees all resources
public java.sql.Connection getConnection()
Gets an available JDBC Connection. Connections will be created if necessary, up to the maximum number of connections as specified in the configuration file.
public void close(java.sql.Connection con)
Places the connection back into the connection pool, or closes the connection if the maximum use count has been reached
con
- Connection object to closepublic void printPool()
Prints the contents of the connection pool to the standard output device
public void TimerEvent(java.lang.Object object)
Called by the timer each time a clock cycle expires. This gives us the opportunity to timeout connections
TimerEvent
在接口中 TimerListener
object
- Object