|
DODS 7.5 API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.lutris.appserver.server.sql.datasource.SimpleDataSourceConnectionAllocator
public class SimpleDataSourceConnectionAllocator
Brief description of the patch: Since each long-time used connection holds too much memory (about 15Mb after several hours of work) it was decided to close and recreate connections that were allocated more than the MaxConnectionUsages value set in the proper config file. We also changed the stack-like structure of the connection pool to queue-like. This guarantees that no connections become stagnant. 4.07.2003
| Field Summary | |
|---|---|
protected java.lang.String |
connectionAllocateCheckSql
database "ConnectionCheckSql" string |
protected java.lang.String |
connectionReleaseCheckSql
database "ConnectionReleaseCheckSql" string |
protected javax.sql.DataSource |
dataSource
JDBC URL of database. |
protected boolean |
disableConnectionPool
Indicates dods not to use connection pool. |
protected int |
generation
Generation number. |
protected LogicalDatabase |
logicalDatabase
Reference to the logical database for easy access to the connection pool. |
protected int |
maxPreparedStatements
Maximum number of prepared statements to use; if less-than zero, then JDBC is queried for this value. |
protected int |
maxWaitingConnections
JP Patch Maximum number of DBConnections that will be waiting in the pool |
protected long |
numRequests
Number of queries or transactions on this logical database. |
protected java.lang.String |
password
SQL password.. |
protected int |
queryTimeOut
Maximum amount of time in seconds to block on a query. |
protected java.lang.String |
shutDownStr
database "ShutDown" string |
protected boolean |
sqlLogging
Indicates if logging is enabled. |
protected int |
transactionTimeOut
Maximum amount of time in seconds to block on a transaction. |
protected java.lang.String |
url
JDBC URL of database. |
protected java.lang.String |
user
SQL user name. |
| Constructor Summary | |
|---|---|
SimpleDataSourceConnectionAllocator(LogicalDatabase logicalDatabase,
Config conConfig)
Initialize the connection allocator object. |
|
| Method Summary | |
|---|---|
DBConnection |
allocate()
If pool is used: Allocate a connection to a thread. |
protected DBConnection |
createConnection()
Create a new connection in the pool. |
void |
drop(DBConnection dbConnection)
Called when a connection in this pool has an SQL error. |
void |
dropAllNow()
Called when the database manager is shutting down: Close all connections immediately. |
protected void |
finalize()
Finalizer. |
int |
getActiveCount()
Return the number of currently active connections. |
java.lang.String |
getDatabaseName()
|
int |
getMaxCount()
Return the maximum number of connections active at one time. |
java.util.Date |
getMaxCountDate()
Return the time when the maximum connection count occured. |
long |
getRequestCount()
Return the number of database requests. |
void |
incrementRequesteCount()
|
boolean |
performRollbackOnReset()
|
void |
release(DBConnection dbConnection)
Return a connection to the pool (if used else only close connection). |
void |
resetMaxCount()
Reset the maximum connection count and date. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected LogicalDatabase logicalDatabase
protected javax.sql.DataSource dataSource
protected java.lang.String url
protected java.lang.String user
protected java.lang.String password
protected java.lang.String shutDownStr
protected java.lang.String connectionAllocateCheckSql
protected java.lang.String connectionReleaseCheckSql
protected long numRequests
protected int maxWaitingConnections
protected boolean sqlLogging
protected boolean disableConnectionPool
protected int queryTimeOut
protected int transactionTimeOut
protected int maxPreparedStatements
protected int generation
| Constructor Detail |
|---|
public SimpleDataSourceConnectionAllocator(LogicalDatabase logicalDatabase,
Config conConfig)
throws ConfigException
logicalDatabase - LogicalDatabase.conConfig - LogicalDatabase Config object
ConfigException - if bad configuration information is given in the config
file.| Method Detail |
|---|
protected DBConnection createConnection()
throws java.sql.SQLException
java.sql.SQLException - If a SQL error occures.
public DBConnection allocate()
throws java.sql.SQLException
allocate in interface ConnectionAllocatorjava.sql.SQLException - If a SQL error occures.public void release(DBConnection dbConnection)
release in interface ConnectionAllocatordbConnection - The connection object to return.public void drop(DBConnection dbConnection)
drop in interface ConnectionAllocatordbConnection - The connection object to drop. The connection should be
returned to the pool after this function returns.public void dropAllNow()
dropAllNow in interface ConnectionAllocatorpublic int getActiveCount()
getActiveCount in interface ConnectionAllocatorpublic int getMaxCount()
getMaxCount in interface ConnectionAllocatorpublic java.util.Date getMaxCountDate()
getMaxCountDate in interface ConnectionAllocatorDate when the maximum connection count
occured.public void resetMaxCount()
resetMaxCount in interface ConnectionAllocatorpublic long getRequestCount()
getRequestCount in interface ConnectionAllocatorprotected void finalize()
finalize in class java.lang.Objectpublic java.lang.String getDatabaseName()
getDatabaseName in interface ConnectionAllocatorpublic void incrementRequesteCount()
incrementRequesteCount in interface ExtendedConnectionAllocatorpublic boolean performRollbackOnReset()
performRollbackOnReset in interface ExtendedConnectionAllocator
|
DODS 7.5 API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||