|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ge.research.utils.db.SingleConnectionManager
A connection broker that keeps at most a single connection to a database active and available for use.
| Field Summary |
| Fields inherited from interface com.ge.research.utils.db.ConnectionBroker |
DB_ATTEMPTS_KEY, DB_CONNTIMEOUT_KEY, DB_DRIVER_KEY, DB_MAXCONN_KEY, DB_MINCONN_KEY, DB_PWD_KEY, DB_URL_KEY, DB_USERNAME_KEY, DB_WAITTIME_KEY, MAX_CONNECTIONS, MIN_CONNECTIONS |
| Constructor Summary | |
SingleConnectionManager(java.lang.String resourceFile)
Constructs the connection manager using the database connection information contained in the resource bundle argument name. |
|
| Method Summary | |
void |
freeConnection(java.sql.Connection c)
Returns the connection from use and releases it back tot he pool of available connections which can be accessed by requestors. |
java.sql.Connection |
getConnection()
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
|
int |
getLoginTimeout()
|
java.io.PrintWriter |
getLogWriter()
|
int |
getMaxConnections()
Returns the current setting for the maximum allowable size of the connection pool. |
int |
getMaxDbAttempts()
Returns the current setting for the maximum number of consecutive attempts at requesting a connection from the pool (without obtaining a free connection), before generating an error. |
int |
getMinConnections()
Returns the current setting for the minimum allowable size of the connection pool. |
int |
getNumberFreeConnections()
Returns the number of currently free and available connections in the pool |
long |
getTimeout()
Returns the current setting for the number of milliseconds to keep pooled connections not in use active and open. |
boolean |
isConnectionOpen()
Checks the status of the connection, returning true if the connection can be used |
void |
setLoginTimeout(int i)
|
void |
setLogWriter(java.io.PrintWriter out)
|
void |
setMaxConnections(int num)
Sets the maximum allowable size of the connection pool. |
void |
setMaxDbAttempts(int i)
Sets the maximum number of consecutive attempts allowed when requesting a connection from the pool (without obtaining a free connection), before generating an error. |
void |
setMinConnections(int num)
Sets the minimum allowable size of the connection pool. |
void |
setTimeout(long l)
Sets the number of milliseconds to keep pooled connections not in use active and open. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SingleConnectionManager(java.lang.String resourceFile)
throws java.lang.Exception
resourceFile - the resource bundle name
java.lang.Exception - If the resource bundle information could not be loaded,
or the database driver could not be registered.| Method Detail |
public void freeConnection(java.sql.Connection c)
ConnectionBroker
freeConnection in interface ConnectionBrokerc - the connection to return to the available poolpublic java.sql.Connection getConnection()
getConnection in interface javax.sql.DataSource
public java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic int getLoginTimeout()
getLoginTimeout in interface javax.sql.DataSource
public java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic int getMaxConnections()
ConnectionBroker
getMaxConnections in interface ConnectionBrokerpublic int getMaxDbAttempts()
ConnectionBroker
getMaxDbAttempts in interface ConnectionBrokerpublic int getMinConnections()
ConnectionBroker
getMinConnections in interface ConnectionBrokerpublic int getNumberFreeConnections()
ConnectionBroker
getNumberFreeConnections in interface ConnectionBroker
public long getTimeout()
throws java.lang.UnsupportedOperationException
ConnectionBroker
getTimeout in interface ConnectionBrokerjava.lang.UnsupportedOperationExceptionpublic final boolean isConnectionOpen()
true if the connection can be used
true if the connection is not null and has not been closed by an application or the database;
false otherwise.public void setLoginTimeout(int i)
setLoginTimeout in interface javax.sql.DataSource
public void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
setLogWriter in interface javax.sql.DataSourcejava.sql.SQLException
public void setMaxConnections(int num)
throws java.lang.UnsupportedOperationException
ConnectionBroker
setMaxConnections in interface ConnectionBrokernum - the maximum allowable size of the connection pool
java.lang.UnsupportedOperationExceptionpublic void setMaxDbAttempts(int i)
ConnectionBroker
setMaxDbAttempts in interface ConnectionBrokeri - the maximum number of attempts to obtain a free connection from the pool
public void setMinConnections(int num)
throws java.lang.UnsupportedOperationException
ConnectionBroker
setMinConnections in interface ConnectionBrokernum - the minimum allowable size of the connection pool
java.lang.UnsupportedOperationException
public void setTimeout(long l)
throws java.lang.UnsupportedOperationException
ConnectionBroker
setTimeout in interface ConnectionBrokerl - the number of milliseconds to keep pooled connections not in use active and open
java.lang.UnsupportedOperationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||