|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--planetj.database.connection.DataEngineConnectionPool
Nested Class Summary | |
static class |
DataEngineConnectionPool.RunningTotal
|
Field Summary | |
static int |
INFINITE_ORPHAN_TIMEOUT
|
static Comparator |
RUNNING_TOTAL_AVERAGE_COMPARATOR
|
Constructor Summary | |
DataEngineConnectionPool(String driver,
String server,
String pAlias,
String login,
String password,
int minConnections,
int maxConnections,
int maxConnSeconds,
int orphanTimeout)
|
Method Summary | |
void |
addListener(IConnectionListener listener)
Adds a listener to this connection pool |
void |
destroy()
Closes down this connection pool. |
void |
destroy(int pMaxWaitMilliseconds)
Closes down this connection pool. |
String |
dump()
Method used for debugging purposes. |
String |
dumpHTML()
Method used for debugging purposes. |
boolean |
freeConnection(Connection connection)
Frees a connection, returning it to the pool so others can use it. |
ConnectionPoolReport |
generateApproximateReport()
Creates a ConnectionPoolReport from the information in this connection pool. |
ConnectionPoolReport |
generateExactReport(boolean clearStatistics)
Creates a ConnectionPoolReport from the information in this connection pool. |
long |
getAge(DataEngineConnection connection)
|
String |
getAlias()
Gets the alias for the database system to which this connection pool's connections are conntected. |
Connection |
getConnection()
Gets an available connection from the connection pool |
Connection |
getConnection(DataEngineConnection connection)
Attempts to get the specified connection from the connection pool |
Connection |
getConnection(String sql)
Gets a Connection which will be used to execute the specified SQL. |
Connection |
getConnection(String userID,
String password)
Gets a connection for the specified userid and password. |
int[] |
getConnectionUsageCounts()
Returns information about the amount of usage this connection pool has seen. |
String |
getCreationTimeText()
Gets a String containing the time the pool was created. |
DataEngineConnectionPool.RunningTotal |
getGrandTotal()
Gets information about all sql statements run from this connection pool. |
int |
getLoginTimeout()
Gets the amount of time this ConnectionPool will wait as it attempts to login to the database. |
PrintWriter |
getLogWriter()
Gets the print writer used for logging. |
int |
getMaximumConnections()
Gets the maximum size of this connection pool. |
int |
getMinimumConnections()
Gets the minimum size of this connection pool. |
PreparedStatementManager |
getPreparedStatementManager()
Gets this connection pool's prepared statement manager |
DataEngineConnectionPool.RunningTotal |
getQueryTotal()
Gets information about queries run from this connection pool. |
ConnectionPoolReportDescriptor |
getReportDescriptor()
Gets the report descriptor for this connection pool |
int |
getSize()
Gets the number of connections in this connection pool. |
Map |
getStatementMap()
Gets the Map of statements that have been executed from this connection pool |
int |
getTimeoutSeconds()
If no connections have been retrieved from this connection pool after this amount of time, then this connection pool will close itself. |
DataEngineConnectionPool.RunningTotal |
getUpdateTotal()
Gets information about updates run from this connection pool. |
String |
getURL()
Gets the url for the database system to which this connection pool's connections are conntected. |
int |
getUseCount()
Gets the number of connections in this connection pool that are currently in use. |
DataEngineConnectionPool.RunningTotal |
getWaitTotal()
Gets information about the connection requests that have had to wait (from this connection pool). |
static int |
idOfConnection(DataEngineConnection connection)
|
boolean |
isAvailable()
Tests if this connection pool is available for use |
void |
queryExecuted(String sql,
long begin,
long time)
Records a query that has executed, and the time it took to execute. |
void |
reconnect()
Shuts down all of the connections in the connection pool and restarts them. |
void |
reconnect(int pMaxWaitMilliseconds)
Shuts down all of the connections in the connection pool and restarts them. |
void |
removeListener(IConnectionListener listener)
Removes a listener from this connection pool |
void |
run()
|
void |
setLoginTimeout(int arg1)
Sets the amount of time this connection pool will wait for when attempting to login to the database. |
void |
setLogWriter(PrintWriter arg1)
Sets the print writer used for logging. |
void |
setReportDescriptor(ConnectionPoolReportDescriptor descriptor)
Sets the report descriptor for this connection pool |
void |
setTimeoutSeconds(int newTimeoutSeconds)
If no connections have been retrieved from this connection pool after this amount of time, then this connection pool will close itself. |
void |
statementExecuted(String sql,
long begin,
long time)
Records a statement that has executed, and the time it took to execute. |
void |
updateExecuted(String sql,
long begin,
long time)
Records an update that has executed, and the time it took to execute. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INFINITE_ORPHAN_TIMEOUT
public static final Comparator RUNNING_TOTAL_AVERAGE_COMPARATOR
Constructor Detail |
public DataEngineConnectionPool(String driver, String server, String pAlias, String login, String password, int minConnections, int maxConnections, int maxConnSeconds, int orphanTimeout) throws SQLException
Method Detail |
public void addListener(IConnectionListener listener)
public void destroy()
public void destroy(int pMaxWaitMilliseconds)
pMaxWaitMilliseconds
- The maximum time to wait for connections which are in use when this method is
invoked to be freed. After this amount of time, any connections still in use are forcible shut down.public String dump()
public String dumpHTML()
public boolean freeConnection(Connection connection)
connection
- The connection to free
public ConnectionPoolReport generateApproximateReport()
ConnectionPoolReport
from the information in this connection pool.
This method does not lock the connection pool as it generates the report, so individual statistics in the
report may reflect the connection pool's state at slightly different points in time. The
generateExactReport()
method captures the connection pool's
state at a single point in time.
ConnectionPoolReport
containing information about how this
connection pools was used, or null if monitoring
is turned off.public ConnectionPoolReport generateExactReport(boolean clearStatistics)
ConnectionPoolReport
from the information in this connection pool.
This method locks the connection pool as it generates the report (this may slightly hurt performance,
but ensures a more accurate report).
clearStatistics
- If all of the stored performance statistics should be cleared after the report is
generated.
ConnectionPoolReport
containing information about how this
connection pools was used, or null if monitoring
is turned off.public long getAge(DataEngineConnection connection)
public String getAlias()
public Connection getConnection() throws SQLException
getConnection
in interface javax.sql.DataSource
SQLException
public Connection getConnection(String sql) throws DataEngineException
getConnection
in interface DataEngineDataSource
DataEngineException
public Connection getConnection(String userID, String password) throws SQLException
getConnection
in interface javax.sql.DataSource
SQLException
public Connection getConnection(DataEngineConnection connection) throws DataEngineException
DataEngineException
public int[] getConnectionUsageCounts()
Returns information about the amount of usage this connection pool has seen. In the returned array, the value at position x indicates the number of times a connection was requested when x connections were already in use. So the value at position 0 is how many times a connection was requested when no connections were in use. The value at position 1 is the number of times a connection was requested when 1 connection was already in use, and so on.
The total sum of all the values in the array is the total number of connections that have been requested.
This method is not synchronized, so the values may not represent the exact state of the connection pool at any specific time
public String getCreationTimeText()
public DataEngineConnectionPool.RunningTotal getGrandTotal()
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface javax.sql.DataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface javax.sql.DataSource
SQLException
public int getMaximumConnections()
public int getMinimumConnections()
public PreparedStatementManager getPreparedStatementManager()
public DataEngineConnectionPool.RunningTotal getQueryTotal()
public ConnectionPoolReportDescriptor getReportDescriptor()
public int getSize()
public Map getStatementMap()
public int getTimeoutSeconds()
public DataEngineConnectionPool.RunningTotal getUpdateTotal()
public String getURL()
public int getUseCount()
public DataEngineConnectionPool.RunningTotal getWaitTotal()
public static int idOfConnection(DataEngineConnection connection)
public boolean isAvailable()
public void queryExecuted(String sql, long begin, long time)
sql
- The sql statement that was executed.begin
- When the query was initiatedtime
- The time it took to execute. This should be less than 0 if and only if the
query execution failed.public void reconnect() throws SQLException
SQLException
public void reconnect(int pMaxWaitMilliseconds) throws SQLException
pMaxWaitMilliseconds
- The maximum time to wait for connections which are in use to be freed.
After this amount of time, any connections still in use are forcibly shut down.
SQLException
public void removeListener(IConnectionListener listener)
public void run()
run
in interface Runnable
public void setLoginTimeout(int arg1) throws SQLException
setLoginTimeout
in interface javax.sql.DataSource
SQLException
public void setLogWriter(PrintWriter arg1) throws SQLException
setLogWriter
in interface javax.sql.DataSource
SQLException
public void setReportDescriptor(ConnectionPoolReportDescriptor descriptor)
public void setTimeoutSeconds(int newTimeoutSeconds)
public void statementExecuted(String sql, long begin, long time)
sql
- The sql statement that was executed.begin
- When the statement was executedtime
- The time it took to execute. This should be less than 0 if and only if the
query execution failed.public void updateExecuted(String sql, long begin, long time)
sql
- The sql statement that was executed.begin
- When the update was initiatedtime
- The time it took to execute. This should be less than 0 if and only if the
query execution failed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |