|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectse.kmr.scam.local.pool.ConnectionPool
A ConnectionPool
manages a set of connections
that can be allocated and reused.
When created, a ConnectionPool
is associated
with a specific ConnectionFactory
,
which creates new connections when asked.
The pool has operating parameters that can be set
in its constructor by means of a Properties
object:
A client of this class allocates a connection by calling
getConnection()
. A maximum wait time can
be specified on this call. When the client is done
with the connection, the client calls
releaseConnection(connection)
ConnectionFactory
,
Connection
,
PoolEntry
Constructor Summary | |
ConnectionPool(ConnectionFactory factory,
int minEntries,
int maxEntries)
Creates a connection pool with specified properties using the specified pooled connection factory |
Method Summary | |
void |
close()
Closes the pool, first closing all the unallocated entries |
Connection |
getConnection()
Allocates an entry from the pool, creating one if necessary (if the pool is not at maximum size). |
Connection |
getConnection(long timeout)
Allocates an entry from the pool, creating one if necessary (if the pool is not at maximum size). |
Connection |
getConnection(String name,
String pw)
|
int |
getLoginTimeout()
|
PrintWriter |
getLogWriter()
|
void |
refresh()
Refreshes the entries in the pool. |
void |
releaseConnection(Connection con)
Releases a resource back to the pool |
void |
setLoginTimeout(int time)
|
void |
setLogWriter(PrintWriter writer)
|
String |
toString()
Returns the pool as a string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConnectionPool(ConnectionFactory factory, int minEntries, int maxEntries) throws SQLException
factory
- the factory class that creates
new instances of the pooled connection.
PoolException
- if the pool cannot
be created.
SQLException
Method Detail |
public int getLoginTimeout()
getLoginTimeout
in interface DataSource
public void setLoginTimeout(int time)
setLoginTimeout
in interface DataSource
public PrintWriter getLogWriter()
getLogWriter
in interface DataSource
public void setLogWriter(PrintWriter writer)
setLogWriter
in interface DataSource
public Connection getConnection(String name, String pw)
getConnection
in interface DataSource
public void close()
public Connection getConnection(long timeout) throws SQLException
timeout
- the maximum number of milliseconds
to wait before giving up. A value of -1 means
to wait indefinitely.
SQLException
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
Connection
,
or null if one cannot be allocated.
SQLException
public void refresh() throws SQLException
SQLException
public void releaseConnection(Connection con)
con
- the underlying pooled conpublic String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |