|
DODS 7.2 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lutris.appserver.server.sql.standard.SimpleConnectionAllocator
public class SimpleConnectionAllocator
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 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 | |
---|---|
SimpleConnectionAllocator(LogicalDatabase logicalDatabase,
Config conConfig)
Initialize the connection allocator object. |
Method Summary | |
---|---|
DBConnection |
allocate()
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. |
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 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 int queryTimeOut
protected int transactionTimeOut
protected int maxPreparedStatements
protected int generation
Constructor Detail |
---|
public SimpleConnectionAllocator(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 ConnectionAllocator
java.sql.SQLException
- If a SQL error occures.public void release(DBConnection dbConnection)
release
in interface ConnectionAllocator
dbConnection
- The connection object to return.public void drop(DBConnection dbConnection)
drop
in interface 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 ConnectionAllocator
public int getActiveCount()
getActiveCount
in interface ConnectionAllocator
public int getMaxCount()
getMaxCount
in interface ConnectionAllocator
public java.util.Date getMaxCountDate()
getMaxCountDate
in interface ConnectionAllocator
Date
when the maximum connection
count occured.public void resetMaxCount()
resetMaxCount
in interface ConnectionAllocator
public long getRequestCount()
getRequestCount
in interface ConnectionAllocator
protected void finalize()
finalize
in class java.lang.Object
public java.lang.String getDatabaseName()
getDatabaseName
in interface ConnectionAllocator
public void incrementRequesteCount()
incrementRequesteCount
in interface ExtendedConnectionAllocator
public boolean performRollbackOnReset()
performRollbackOnReset
in interface ExtendedConnectionAllocator
|
DODS 7.2 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |