|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaexchange.dbConnectionBroker.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. |
|
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,
boolean logAppend)
|
|
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,
boolean logAppend,
int maxCheckoutSeconds,
int debugLevel)
|
Method Summary | |
void |
destroy()
Less safe shutdown. |
void |
destroy(int millis)
Multi-phase shutdown. |
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
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, boolean logAppend) throws java.io.IOException
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, boolean logAppend, int maxCheckoutSeconds, int debugLevel) throws java.io.IOException
Method Detail |
public void run()
run
in interface java.lang.Runnable
public java.sql.Connection getConnection()
public int idOfConnection(java.sql.Connection conn)
public java.lang.String freeConnection(java.sql.Connection conn)
public long getAge(java.sql.Connection conn)
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
- the time to wait in milliseconds.
java.sql.SQLException
- if connections were in use after
millis
.public void destroy()
destroy()
method
with a millis
value of 10000 (10 seconds) and ignores SQLException
thrown by that method.
destroy(int)
public int getUseCount()
public int getSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |