|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.jdbc.util.JdbcUtil | +--org.enhydra.jdbc.core.CoreDataSource | +--org.enhydra.jdbc.pool.StandardPoolDataSource
StandardPoolDataSource class allows to make some operations on PooledConnection. It implements PoolHelper for the 3 methods :
create : create a PooledConnection
create(user,password) : create a PooledConnection with an other user/password
testThisObject : check if the object is still valid
checkThisObject : check if the object is closed
expire : kill the object
Field Summary | |
javax.sql.ConnectionPoolDataSource |
cpds
|
java.lang.String |
dataSourceName
|
org.apache.commons.logging.Log |
glog
|
javax.naming.Context |
ictx
|
boolean |
onOff
|
GenericPool |
pool
|
Fields inherited from class org.enhydra.jdbc.core.CoreDataSource |
logWriter, password, user |
Fields inherited from class org.enhydra.jdbc.util.JdbcUtil |
log |
Constructor Summary | |
StandardPoolDataSource()
Constructor |
|
StandardPoolDataSource(javax.sql.ConnectionPoolDataSource cc)
Constructor |
|
StandardPoolDataSource(javax.sql.ConnectionPoolDataSource cc,
int initSize)
Constructor |
|
StandardPoolDataSource(int initSize)
Constructor |
Method Summary | |
boolean |
checkThisObject(java.lang.Object o)
This method tests if a connection is closed or not |
void |
connectionClosed(javax.sql.ConnectionEvent event)
Invoked when the application calls close() on its representation of the connection |
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
connectionErrorOccurred and connectionClosed are methods from ConnectionEventListener interface Invoked when a fatal connection error occurs, just before an SQLException is thrown to the application |
GenerationObject |
create()
|
GenerationObject |
create(java.lang.String _user,
java.lang.String _password)
|
void |
expire(java.lang.Object o)
object specific work to kill the object |
int |
getCheckLevelObject()
|
java.sql.Connection |
getConnection()
getConnection allows to get an object from the pool and returns it to the user. |
java.sql.Connection |
getConnection(java.lang.String _user,
java.lang.String _password)
getConnection allows to get an object from the pool and returns it to the user. |
java.lang.String |
getDataSourceName()
|
long |
getDeadLockMaxWait()
|
long |
getDeadLockRetryWait()
|
int |
getGeneration()
|
java.lang.String |
getJdbcTestStmt()
|
long |
getLifeTime()
|
int |
getLockedObjectCount()
|
java.io.PrintWriter |
getLogWriter()
|
int |
getMaxSize()
|
int |
getMinSize()
|
java.lang.Object |
getObjectInstance(java.lang.Object refObj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable env)
Methods inherited from ObjectFactory |
javax.naming.Reference |
getReference()
Retrieves the Reference of this object. |
long |
getSleepTime()
|
int |
getUnlockedObjectCount()
|
boolean |
isGC()
|
void |
setCheckLevelObject(int checkLevelObject)
|
void |
setDataSourceName(java.lang.String dataSourceName)
Set up the data source name, get the initial context, and lookup in JNDI to obtain a reference of the DataSourceName this method must be called before a getConnection (in this case an exception is returned |
void |
setDeadLockMaxWait(long deadLock)
|
void |
setDeadLockRetryWait(long loopWait)
|
void |
setDebug(boolean debug)
|
void |
setGC(boolean gc)
|
void |
setGeneration(int generation)
|
void |
setJdbcTestStmt(java.lang.String jdbcTestStmt)
|
void |
setLifeTime(long lifeTime)
|
void |
setLogWriter(java.io.PrintWriter logWriter)
Set/Get methods |
void |
setMaxSize(int maxSize)
|
void |
setMinSize(int minSize)
|
void |
setSleepTime(long sleepTime)
|
void |
setThreadFactory(JdbcThreadFactory tf)
Override this so that the pool's tf gets set as well |
void |
shutdown(boolean force)
shutdown is a placeholder for datasources which should shut down any pools which they maintain. |
void |
stopPool()
stop method to switch off the pool |
boolean |
testThisObject(java.lang.Object o)
This method tests if a connection is valid or not |
java.lang.String |
toString()
|
Methods inherited from class org.enhydra.jdbc.core.CoreDataSource |
getDescription, getLoginTimeout, getPassword, getThreadFactory, getUser, isDebug, isVerbose, setDescription, setLoginTimeout, setPassword, setUser, setVerbose |
Methods inherited from class org.enhydra.jdbc.util.JdbcUtil |
setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.sql.DataSource |
getLoginTimeout, setLoginTimeout |
Field Detail |
public javax.sql.ConnectionPoolDataSource cpds
public GenericPool pool
public java.lang.String dataSourceName
public boolean onOff
public javax.naming.Context ictx
public org.apache.commons.logging.Log glog
Constructor Detail |
public StandardPoolDataSource()
public StandardPoolDataSource(int initSize)
public StandardPoolDataSource(javax.sql.ConnectionPoolDataSource cc)
public StandardPoolDataSource(javax.sql.ConnectionPoolDataSource cc, int initSize)
Method Detail |
public void setDataSourceName(java.lang.String dataSourceName)
public java.lang.String getDataSourceName()
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String _user, java.lang.String _password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
connectionErrorOccurred
in interface javax.sql.ConnectionEventListener
public void connectionClosed(javax.sql.ConnectionEvent event)
connectionClosed
in interface javax.sql.ConnectionEventListener
public void expire(java.lang.Object o)
expire
in interface PoolHelper
public boolean checkThisObject(java.lang.Object o)
checkThisObject
in interface PoolHelper
public boolean testThisObject(java.lang.Object o)
testThisObject
in interface PoolHelper
public GenerationObject create() throws java.sql.SQLException
create
in interface PoolHelper
java.sql.SQLException
public GenerationObject create(java.lang.String _user, java.lang.String _password) throws java.sql.SQLException
create
in interface PoolHelper
java.sql.SQLException
public void stopPool()
public void shutdown(boolean force)
CoreDataSource
shutdown
in class CoreDataSource
public void setLogWriter(java.io.PrintWriter logWriter)
setLogWriter
in interface javax.sql.DataSource
setLogWriter
in class CoreDataSource
public void setDebug(boolean debug)
setDebug
in class CoreDataSource
public void setMinSize(int minSize) throws java.lang.Exception
java.lang.Exception
public void setMaxSize(int maxSize) throws java.lang.Exception
java.lang.Exception
public void setLifeTime(long lifeTime)
public void setSleepTime(long sleepTime)
public void setGC(boolean gc)
public void setCheckLevelObject(int checkLevelObject)
public void setJdbcTestStmt(java.lang.String jdbcTestStmt)
public void setGeneration(int generation)
public void setDeadLockMaxWait(long deadLock)
public void setDeadLockRetryWait(long loopWait)
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.DataSource
getLogWriter
in class CoreDataSource
public int getMinSize()
public int getMaxSize()
public long getLifeTime()
public long getSleepTime()
public int getGeneration()
public boolean isGC()
public int getLockedObjectCount()
public int getUnlockedObjectCount()
public int getCheckLevelObject()
public java.lang.String getJdbcTestStmt()
public long getDeadLockMaxWait()
public long getDeadLockRetryWait()
public java.lang.String toString()
toString
in class java.lang.Object
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
getReference
in class CoreDataSource
javax.naming.NamingException
- If a naming exception was encountered while
retrieving the reference.public java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable env) throws java.lang.Exception
CoreDataSource
getObjectInstance
in interface javax.naming.spi.ObjectFactory
getObjectInstance
in class CoreDataSource
java.lang.Exception
public void setThreadFactory(JdbcThreadFactory tf)
setThreadFactory
in class CoreDataSource
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |