|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.enhydra.jdbc.util.JdbcUtil
org.enhydra.jdbc.core.CoreDataSource
org.enhydra.jdbc.pool.StandardPoolDataSource
public class 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 | |
|---|---|
ConnectionPoolDataSource |
cpds
|
String |
dataSourceName
|
org.apache.commons.logging.Log |
glog
|
Context |
ictx
|
String |
jdbcTestStmt
|
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(ConnectionPoolDataSource cc)
Constructor |
|
StandardPoolDataSource(ConnectionPoolDataSource cc,
int initSize)
Constructor |
|
StandardPoolDataSource(int initSize)
Constructor |
|
| Method Summary | |
|---|---|
boolean |
checkThisObject(Object o)
This method tests if a connection is closed or not |
void |
connectionClosed(ConnectionEvent event)
Invoked when the application calls close() on its representation of the connection |
void |
connectionErrorOccurred(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(String _user,
String _password)
|
void |
expire(Object o)
object specific work to kill the object |
void |
fullRemoveLockedObject(GenerationObject obj)
|
int |
getCheckLevelObject()
|
Connection |
getConnection()
getConnection allows to get an object from the pool and returns it to the user. |
Connection |
getConnection(String _user,
String _password)
getConnection allows to get an object from the pool and returns it to the user. |
String |
getDataSourceName()
|
long |
getDeadLockMaxWait()
|
long |
getDeadLockRetryWait()
|
int |
getGeneration()
|
String |
getJdbcTestStmt()
|
long |
getLifeTime()
|
int |
getLockedObjectCount()
|
PrintWriter |
getLogWriter()
|
long |
getMaxLifeTime()
|
int |
getMaxSize()
|
int |
getMinSize()
|
Object |
getObjectInstance(Object refObj,
Name name,
Context nameCtx,
Hashtable env)
Methods inherited from ObjectFactory |
GenericPool |
getPool()
|
Reference |
getReference()
Retrieves the Reference of this object. |
long |
getSleepTime()
|
int |
getUnlockedObjectCount()
|
GenericPool |
getUsedPool()
|
boolean |
isGC()
|
void |
removeUnlockedObject(GenerationObject obj)
|
void |
setCheckLevelObject(int checkLevelObject)
set the check level of the pooled object before using them |
void |
setDataSourceName(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)
set the global time the pool can wait for a free object |
void |
setDeadLockRetryWait(long loopWait)
set the time before 2 tries when trying to obtain an object from the pool |
void |
setDebug(boolean debug)
set the debug flag |
void |
setGC(boolean gc)
set the garbage collection option |
void |
setGeneration(int generation)
set the generation number for future connection, the generation number is used to identify a group a created objects |
void |
setJdbcTestStmt(String jdbcTestStmt)
set the String to test the jdbc connection before using it |
void |
setLifeTime(long lifeTime)
set the life time of the pooled objects |
void |
setLogWriter(PrintWriter logWriter)
set the logwriter for the current object, the logwriter will be use by the current object and by the generic pool |
void |
setMaxLifeTime(long maxLifeTime)
|
void |
setMaxSize(int maxSize)
set the maximum size of the pool |
void |
setMinSize(int minSize)
set the minimum size of the pool |
void |
setSleepTime(long sleepTime)
set the sleep time of pooled objects |
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(Object o)
This method tests if a connection is valid or not |
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.CommonDataSource |
|---|
getLoginTimeout, setLoginTimeout |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor, unwrap |
| Field Detail |
|---|
public ConnectionPoolDataSource cpds
public GenericPool pool
public String dataSourceName
public String jdbcTestStmt
public boolean onOff
public Context ictx
public org.apache.commons.logging.Log glog
| Constructor Detail |
|---|
public StandardPoolDataSource()
public StandardPoolDataSource(int initSize)
public StandardPoolDataSource(ConnectionPoolDataSource cc)
public StandardPoolDataSource(ConnectionPoolDataSource cc,
int initSize)
| Method Detail |
|---|
public void setDataSourceName(String dataSourceName)
public String getDataSourceName()
public Connection getConnection()
throws SQLException
getConnection in interface DataSourceSQLException
public Connection getConnection(String _user,
String _password)
throws SQLException
getConnection in interface DataSourceSQLExceptionpublic void connectionErrorOccurred(ConnectionEvent event)
connectionErrorOccurred in interface ConnectionEventListenerpublic void connectionClosed(ConnectionEvent event)
connectionClosed in interface ConnectionEventListenerpublic void expire(Object o)
expire in interface PoolHelperpublic boolean checkThisObject(Object o)
checkThisObject in interface PoolHelperpublic boolean testThisObject(Object o)
testThisObject in interface PoolHelper
public GenerationObject create()
throws SQLException
create in interface PoolHelperSQLException
public GenerationObject create(String _user,
String _password)
throws SQLException
create in interface PoolHelperSQLExceptionpublic void stopPool()
public void shutdown(boolean force)
CoreDataSource
shutdown in class CoreDataSourcepublic void setLogWriter(PrintWriter logWriter)
setLogWriter in interface CommonDataSourcesetLogWriter in class CoreDataSourcelogWriter - a PrintWriter objectpublic void setDebug(boolean debug)
setDebug in class CoreDataSourcedebug - a boolean flag
public void setMinSize(int minSize)
throws Exception
minSize - minimum size of the pool
Exception
public void setMaxSize(int maxSize)
throws Exception
maxSize - maximum size of the pool
Exceptionpublic void setLifeTime(long lifeTime)
lifeTime - life time of the pooled objects (in milliseconds)public void setSleepTime(long sleepTime)
sleepTime - sleep time of the pooled objects (in milliseconds)public void setGC(boolean gc)
gc - true: the garbage collector will be launched when clean up of the
pool, else falsepublic void setCheckLevelObject(int checkLevelObject)
checkLevelObject - (public void setJdbcTestStmt(String jdbcTestStmt)
jdbcTestStmt - an sql statementpublic void setGeneration(int generation)
generation - an integer value which represents a generationpublic void setDeadLockMaxWait(long deadLock)
deadLock - in millisecondspublic void setDeadLockRetryWait(long loopWait)
loopWait - in millisecondspublic PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourcegetLogWriter in class CoreDataSourcepublic 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 String getJdbcTestStmt()
public long getDeadLockMaxWait()
public long getDeadLockRetryWait()
public String toString()
toString in interface PoolHelpertoString in class CoreDataSource
public Reference getReference()
throws NamingException
getReference in interface ReferenceablegetReference in class CoreDataSourceNamingException - If a naming exception was encountered while
retrieving the reference.
public Object getObjectInstance(Object refObj,
Name name,
Context nameCtx,
Hashtable env)
throws Exception
CoreDataSource
getObjectInstance in interface ObjectFactorygetObjectInstance in class CoreDataSourceExceptionpublic void setThreadFactory(JdbcThreadFactory tf)
setThreadFactory in class CoreDataSourcepublic GenericPool getPool()
public void removeUnlockedObject(GenerationObject obj)
public GenericPool getUsedPool()
public void fullRemoveLockedObject(GenerationObject obj)
public void setMaxLifeTime(long maxLifeTime)
public long getMaxLifeTime()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||