|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.is.util.sql.JDBCHelperPool
Before anything else happens, do this:
JDBCHelperPool.createPool(
"XYZ_DB", // Name of the pool
JDBCHelperFactory.create(), // or however you create a JDBCHelper
5); // number of objects in the pool.
Later, when you need a JDBCHelper instance:
JDBCHelperPool.getPool("XYZ_DB").getJDBCHelper();
When done with the pool:
JDBCHelperPool.getPool("XYZ_DB").destroy();
Method Summary | |
static void |
createPool(java.lang.String poolName,
JDBCHelper aJDBCHelper,
int poolSize)
This method must be called before a pool with this name can be retrieved. |
void |
destroy()
Close the JDBCHelper objects and remove them from the stack. |
static void |
destroyPool(java.lang.String poolName)
This method must be called before a pool with this name can be retrieved. |
static JDBCHelper |
getFrom(java.lang.String poolName)
Return a JDBCHelper from the pool. |
JDBCHelper |
getJDBCHelper()
Gets an object from the pool of available ones. |
int |
getMaxAttempts()
Returns the maximum number of attempts that will be made trying to get a connection. |
static JDBCHelperPool |
getPool(java.lang.String poolName)
Return the pool with the given name. |
long |
getWaitTime()
Returns the wait in milliseconds betweent attempts to get a conection |
void |
returnJDBCHelper(JDBCHelper aJDBCHelper)
This method returns an object to the available pool and notifies any threads that are waiting for it. |
void |
setMaxAttempts(int value)
Sets the number of attempts to try to get an object before failing. |
void |
setWaitTime(long value)
Sets the waitTime in milliseconds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void createPool(java.lang.String poolName, JDBCHelper aJDBCHelper, int poolSize)
poolName
- a value of type 'String'aJDBCHelper
- a value of type 'JDBCHelper'poolSize
- a value of type 'int'JDBCHelperPool.getInstance(poolName)
public static void destroyPool(java.lang.String poolName)
poolName
- a value of type 'String'aJDBCHelper
- a value of type 'JDBCHelper'poolSize
- a value of type 'int'JDBCHelperPool.getInstance(poolName)
public static JDBCHelperPool getPool(java.lang.String poolName)
poolName
- a value of type 'String'public static JDBCHelper getFrom(java.lang.String poolName) throws java.sql.SQLException
poolName
- a value of type 'String'public void destroy()
public JDBCHelper getJDBCHelper() throws java.sql.SQLException
java.sql.SQLException
- if an object is not found after n attempts.public void returnJDBCHelper(JDBCHelper aJDBCHelper)
public int getMaxAttempts()
public void setMaxAttempts(int value)
public long getWaitTime()
public void setWaitTime(long value)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |