|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.codestudio.util.ObjectPool | +--com.codestudio.util.JDBCPool
JDBCPool is an ObjectPool of JDBC connection objects. It is also a javax.sql.ConnectionEventListener, so it can respond to events fired by the PooledConnection implementation, PoolManConnection.
Fields inherited from class com.codestudio.util.ObjectPool |
count, lifeguard, locked, logit, metadata, skimmer, unlocked |
Constructor Summary | |
JDBCPool(PoolMetaData metad)
|
Method Summary | |
void |
checkCredentials(java.lang.String username,
java.lang.String password)
|
void |
closeAllResources()
Overriden in order to ensure that JNDI resources are disposed of properly. |
static void |
closeConnection(java.sql.Connection con)
|
static void |
closeResources(java.sql.Connection con,
java.sql.Statement statement,
java.sql.ResultSet resultset)
Static method that closes the Connection, Statement and ResultSets in one place. |
static void |
closeResources(java.sql.Statement statement,
java.sql.ResultSet resultSet)
Static method that closes the statement and result sets in one place; this is here as a convenience to shorten the finally block in statements. |
static void |
closeResultSet(java.sql.ResultSet rs)
This method closes the given ResultSet. |
static void |
closeStatement(java.sql.Statement statement)
Closes the given statement. |
void |
connectionClosed(javax.sql.ConnectionEvent event)
Responds to a ConnectionClosed ConnectionEvent. |
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
Responds to an error event. |
protected java.lang.Object |
create()
Creates a physical Connection and PooledConnection wrapper for it (a PoolManConnection). |
void |
deployDataSource()
|
protected void |
expire(java.lang.Object o)
Closes a physical database connection. |
SQLCache |
getCache()
|
javax.sql.DataSource |
getDataSource()
|
java.lang.String |
getDriver()
|
java.lang.String |
getPassword()
|
int |
getTransactionIsolation()
|
java.lang.String |
getURL()
|
java.lang.String |
getUserName()
|
void |
init()
|
boolean |
isDataSourceDeployed()
|
boolean |
isUsingNativeResults()
|
int |
numPooledStatements(java.lang.String sql)
|
int |
numStatementPools()
|
void |
refreshCache()
Force the cache to refresh. |
java.sql.Connection |
requestConnection()
Retrieves a PooledConnection impl and returns its Handle. |
java.sql.PreparedStatement |
requestPooledStatement(java.lang.String sql)
|
void |
returnConnection(PoolManConnection pcon)
Returns a connection to the pool. |
void |
returnPooledStatement(PoolManPreparedStatement ps)
Retuns a PreparedStatement to the statement pool |
void |
setCache(SQLCache cache)
Associates a SQLCache with this pool. |
void |
setDataSource(PoolManDataSource ds)
Associates a DataSource view with this pool. |
void |
undeployDataSource()
|
boolean |
usingCache()
Determine whether or not this pool is using a SQLCache (configured in poolman.xml and disabled by default). |
protected boolean |
validate(java.lang.Object o)
Checks to see if the current connection is valid. |
Methods inherited from class com.codestudio.util.ObjectPool |
checkIn, checkOut, checkTimeout, cleanUp, debug, debug, debugMetrics, finalize, getPoolname, log, log, numCheckedInObjects, numCheckedOutObjects, numTotalObjects, requestObject, returnObject, updateLocked |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JDBCPool(PoolMetaData metad)
Method Detail |
public void init() throws java.lang.Exception
init
in class ObjectPool
public void setDataSource(PoolManDataSource ds)
public javax.sql.DataSource getDataSource()
public void deployDataSource()
public void undeployDataSource()
public boolean isDataSourceDeployed()
public void setCache(SQLCache cache)
public SQLCache getCache()
public boolean usingCache()
public void refreshCache()
public java.lang.String getDriver()
public java.lang.String getURL()
public java.lang.String getUserName()
public java.lang.String getPassword()
public int getTransactionIsolation()
public boolean isUsingNativeResults()
public void checkCredentials(java.lang.String username, java.lang.String password) throws java.sql.SQLException
public void connectionClosed(javax.sql.ConnectionEvent event)
connectionClosed
in interface javax.sql.ConnectionEventListener
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
connectionErrorOccurred
in interface javax.sql.ConnectionEventListener
protected java.lang.Object create() throws java.sql.SQLException
create
in class ObjectPool
protected boolean validate(java.lang.Object o)
validate
in class ObjectPool
protected void expire(java.lang.Object o)
expire
in class ObjectPool
public java.sql.Connection requestConnection() throws java.sql.SQLException
public void returnConnection(PoolManConnection pcon)
public java.sql.PreparedStatement requestPooledStatement(java.lang.String sql)
public void returnPooledStatement(PoolManPreparedStatement ps)
public int numStatementPools()
public int numPooledStatements(java.lang.String sql)
public void closeAllResources()
closeAllResources
in class ObjectPool
public static void closeResources(java.sql.Connection con, java.sql.Statement statement, java.sql.ResultSet resultset)
public static void closeResources(java.sql.Statement statement, java.sql.ResultSet resultSet)
statement
- the statement to be closedresultSet
- the resultSet to be closedpublic static void closeConnection(java.sql.Connection con)
public static void closeStatement(java.sql.Statement statement)
statement
- the statement to be closed. may be nullpublic static void closeResultSet(java.sql.ResultSet rs)
rs
- the ResultSet to be closed. May be null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |