|
DODS 7.1 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 com.lutris.appserver.server.sql.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(com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase,
com.lutris.util.Config conConfig)
Initialize the connection allocator object. |
Method Summary | |
---|---|
com.lutris.appserver.server.sql.DBConnection |
allocate()
If pool is used: Allocate a connection to a thread. |
protected com.lutris.appserver.server.sql.DBConnection |
createConnection()
Create a new connection in the pool. |
void |
drop(com.lutris.appserver.server.sql.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(com.lutris.appserver.server.sql.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 com.lutris.appserver.server.sql.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(com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase, com.lutris.util.Config conConfig) throws com.lutris.util.ConfigException
logicalDatabase
- LogicalDatabase.conConfig
- LogicalDatabase Config object
com.lutris.util.ConfigException
- if bad configuration information is given in the config
file.Method Detail |
---|
protected com.lutris.appserver.server.sql.DBConnection createConnection() throws java.sql.SQLException
java.sql.SQLException
- If a SQL error occures.public com.lutris.appserver.server.sql.DBConnection allocate() throws java.sql.SQLException
allocate
in interface com.lutris.appserver.server.sql.ConnectionAllocator
java.sql.SQLException
- If a SQL error occures.public void release(com.lutris.appserver.server.sql.DBConnection dbConnection)
release
in interface com.lutris.appserver.server.sql.ConnectionAllocator
dbConnection
- The connection object to return.public void drop(com.lutris.appserver.server.sql.DBConnection dbConnection)
drop
in interface com.lutris.appserver.server.sql.ConnectionAllocator
dbConnection
- The connection object to drop. The connection should be
returned to the pool after this function returns.public void dropAllNow()
dropAllNow
in interface com.lutris.appserver.server.sql.ConnectionAllocator
public int getActiveCount()
getActiveCount
in interface com.lutris.appserver.server.sql.ConnectionAllocator
public int getMaxCount()
getMaxCount
in interface com.lutris.appserver.server.sql.ConnectionAllocator
public java.util.Date getMaxCountDate()
getMaxCountDate
in interface com.lutris.appserver.server.sql.ConnectionAllocator
Date
when the maximum connection count
occured.public void resetMaxCount()
resetMaxCount
in interface com.lutris.appserver.server.sql.ConnectionAllocator
public long getRequestCount()
getRequestCount
in interface com.lutris.appserver.server.sql.ConnectionAllocator
protected void finalize()
finalize
in class java.lang.Object
public java.lang.String getDatabaseName()
getDatabaseName
in interface com.lutris.appserver.server.sql.ConnectionAllocator
public void IncrementRequesteCount()
IncrementRequesteCount
in interface ExtendedConnectionAllocator
public boolean performRollbackOnReset()
performRollbackOnReset
in interface ExtendedConnectionAllocator
|
DODS 7.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |