Class ConnectionPool<T extends ConnectionRecord>
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.Pool<T>
-
- edu.uiuc.ncsa.security.storage.sql.ConnectionPool<T>
-
- Direct Known Subclasses:
DerbyConnectionPool,MariaDBConnectionPool,MySQLConnectionPool
public class ConnectionPool<T extends ConnectionRecord> extends Pool<T>
A pool for jdbc connections. All this needs is configuration for the right jdbc url to use.Created by Jeff Gaynor
on Mar 12, 2010 at 4:06:15 PM
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalreadyShutdownstatic intCONNECTION_TYPE_DEBRYstatic intCONNECTION_TYPE_H2static intCONNECTION_TYPE_MARIADBstatic intCONNECTION_TYPE_MYSQLstatic intCONNECTION_TYPE_POSTGRESstatic intCONNECTION_TYPE_UNKNOWNprotected ConnectionParametersconnectionParametersUUIDuuid-
Fields inherited from class edu.uiuc.ncsa.security.core.util.Pool
DEEP_DEBUG, INFINITE, inUse, maxSize, stack, totalCreated, totalDestroyed
-
-
Constructor Summary
Constructors Constructor Description ConnectionPool()ConnectionPool(SQLConnectionImpl connectionParameters, int connectionType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tcreate()Create a new, ready-to-use object for the poolvoiddestroy(T cc)Destroy an object that is no longer needed.longgetCleanupInterval()ConnectionParametersgetConnectionParameters()longgetIdelLifetime()longgetQueueInterval()StackMapgetStackMap()intgetType()UUIDgetUuid()booleanisCleanupEnabled()booleanisEnableQueue()booleanisValid(T t)Is this item still good? If not it will be removed from the pool so a new one can be created.Tpop()Pop an object off the stack if there is one, otherwise, create one.Tpop(long timeout)voidpush(T object)Check an object into the pool.voidsetCleanupEnabled(boolean cleanupEnabled)voidsetCleanupInterval(long cleanupInterval)voidsetConnectionParameters(ConnectionParameters connectionParameters)voidsetEnableQueue(boolean enableQueue)voidsetIdelLifetime(long idelLifetime)voidsetQueueInterval(long queueInterval)voidsetStackMap(StackMap stackMap)voidsetType(int type)protected voidsetupDriverManager()voidshutdown()For those store that need some cleanup.-
Methods inherited from class edu.uiuc.ncsa.security.core.util.Pool
doCreate, doDestroy, getMaxSize, getStack, setMaxSize, toString, trace
-
-
-
-
Field Detail
-
uuid
public UUID uuid
-
connectionParameters
protected ConnectionParameters connectionParameters
-
CONNECTION_TYPE_UNKNOWN
public static final int CONNECTION_TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
CONNECTION_TYPE_MYSQL
public static final int CONNECTION_TYPE_MYSQL
- See Also:
- Constant Field Values
-
CONNECTION_TYPE_MARIADB
public static final int CONNECTION_TYPE_MARIADB
- See Also:
- Constant Field Values
-
CONNECTION_TYPE_POSTGRES
public static final int CONNECTION_TYPE_POSTGRES
- See Also:
- Constant Field Values
-
CONNECTION_TYPE_DEBRY
public static final int CONNECTION_TYPE_DEBRY
- See Also:
- Constant Field Values
-
CONNECTION_TYPE_H2
public static final int CONNECTION_TYPE_H2
- See Also:
- Constant Field Values
-
alreadyShutdown
protected boolean alreadyShutdown
-
-
Constructor Detail
-
ConnectionPool
public ConnectionPool()
-
ConnectionPool
public ConnectionPool(SQLConnectionImpl connectionParameters, int connectionType)
-
-
Method Detail
-
getUuid
public UUID getUuid()
-
getConnectionParameters
public ConnectionParameters getConnectionParameters()
-
setConnectionParameters
public void setConnectionParameters(ConnectionParameters connectionParameters)
-
setType
public void setType(int type)
-
setupDriverManager
protected void setupDriverManager()
-
getStackMap
public StackMap getStackMap()
-
setStackMap
public void setStackMap(StackMap stackMap)
-
create
public T create() throws PoolException
Description copied from class:PoolCreate a new, ready-to-use object for the pool- Specified by:
createin classPool<T extends ConnectionRecord>- Returns:
- the object
- Throws:
PoolException
-
destroy
public void destroy(T cc) throws PoolException
Description copied from class:PoolDestroy an object that is no longer needed.- Specified by:
destroyin classPool<T extends ConnectionRecord>- Parameters:
cc- the object- Throws:
PoolException
-
push
public void push(T object) throws PoolException
Description copied from class:PoolCheck an object into the pool. If the pool is at capacity, destroy the object.- Overrides:
pushin classPool<T extends ConnectionRecord>- Parameters:
object- the object- Throws:
PoolException
-
pop
public T pop(long timeout) throws PoolException, InterruptedException
- Throws:
PoolExceptionInterruptedException
-
pop
public T pop() throws PoolException
Description copied from class:PoolPop an object off the stack if there is one, otherwise, create one.- Overrides:
popin classPool<T extends ConnectionRecord>- Returns:
- the object
- Throws:
PoolException
-
isValid
public boolean isValid(T t) throws PoolException
Description copied from class:PoolIs this item still good? If not it will be removed from the pool so a new one can be created. Default is to return true.- Overrides:
isValidin classPool<T extends ConnectionRecord>- Throws:
PoolException
-
isCleanupEnabled
public boolean isCleanupEnabled()
-
setCleanupEnabled
public void setCleanupEnabled(boolean cleanupEnabled)
-
getCleanupInterval
public long getCleanupInterval()
-
setCleanupInterval
public void setCleanupInterval(long cleanupInterval)
-
getIdelLifetime
public long getIdelLifetime()
-
setIdelLifetime
public void setIdelLifetime(long idelLifetime)
-
isEnableQueue
public boolean isEnableQueue()
-
setEnableQueue
public void setEnableQueue(boolean enableQueue)
-
getQueueInterval
public long getQueueInterval()
-
setQueueInterval
public void setQueueInterval(long queueInterval)
-
getType
public int getType()
-
shutdown
public void shutdown()
For those store that need some cleanup.
-
-