|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.tw.dbobjects.DbConnectionBroker
DbConnectionBroker A servlet-based broker for database connections. Creates and manages a pool of database connections.
Constructor Summary | |
DbConnectionBroker(java.lang.String dbDriver,
java.lang.String dbServer,
java.lang.String dbLogin,
java.lang.String dbPassword,
int minConns,
int maxConns,
java.lang.String logFileString,
double maxConnTime)
Creates a new Connection Broker dbDriver: JDBC driver. |
Method Summary | |
void |
destroy()
Less safe shutdown. |
void |
destroy(int millis)
Shuts down the housekeeping thread and closes all connections in the pool. |
java.lang.String |
freeConnection(java.sql.Connection conn)
Frees a connection. |
long |
getAge(java.sql.Connection conn)
Returns the age of a connection -- the time since it was handed out to an application. |
java.sql.Connection |
getConnection()
This method hands out the connections in round-robin order. |
int |
getSize()
Returns the number of connections in the dynamic pool. |
int |
getUseCount()
Returns the number of connections in use. |
int |
idOfConnection(java.sql.Connection conn)
Returns the local JDBC ID for a connection. |
void |
run()
Housekeeping thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DbConnectionBroker(java.lang.String dbDriver, java.lang.String dbServer, java.lang.String dbLogin, java.lang.String dbPassword, int minConns, int maxConns, java.lang.String logFileString, double maxConnTime) throws java.io.IOException
dbDriver
- Description of ParameterdbServer
- Description of ParameterdbLogin
- Description of ParameterdbPassword
- Description of ParameterminConns
- Description of ParametermaxConns
- Description of ParameterlogFileString
- Description of ParametermaxConnTime
- Description of Parameterjava.io.IOException
- Description of ExceptionMethod Detail |
public long getAge(java.sql.Connection conn)
conn
- Description of Parameterpublic java.sql.Connection getConnection()
public int getSize()
public int getUseCount()
public void destroy()
destroy()
method with a millis
value of
10000 (10 seconds) and ignores SQLException
thrown by that
method.destroy(int)
public void destroy(int millis) throws java.sql.SQLException
getConnection()
will refuse to return connections.
millis
milliseconds after shutdown of
the housekeeping thread, freeConnection()
can still be
called to return used connections.
millis
milliseconds after the shutdown of the
housekeeping thread, all connections in the pool are closed.
SQLException
is thrown.
millis
- Description of Parameterjava.sql.SQLException
- Description of Exceptionpublic java.lang.String freeConnection(java.sql.Connection conn)
conn
- Description of Parameterpublic int idOfConnection(java.sql.Connection conn)
conn
- Description of Parameterpublic void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |