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 boolean
alreadyShutdown
static int
CONNECTION_TYPE_DEBRY
static int
CONNECTION_TYPE_H2
static int
CONNECTION_TYPE_MARIADB
static int
CONNECTION_TYPE_MYSQL
static int
CONNECTION_TYPE_POSTGRES
static int
CONNECTION_TYPE_UNKNOWN
protected ConnectionParameters
connectionParameters
UUID
uuid
-
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 T
create()
Create a new, ready-to-use object for the poolvoid
destroy(T cc)
Destroy an object that is no longer needed.long
getCleanupInterval()
ConnectionParameters
getConnectionParameters()
long
getIdelLifetime()
long
getQueueInterval()
StackMap
getStackMap()
int
getType()
UUID
getUuid()
boolean
isCleanupEnabled()
boolean
isEnableQueue()
boolean
isValid(T t)
Is this item still good? If not it will be removed from the pool so a new one can be created.T
pop()
Pop an object off the stack if there is one, otherwise, create one.T
pop(long timeout)
void
push(T object)
Check an object into the pool.void
setCleanupEnabled(boolean cleanupEnabled)
void
setCleanupInterval(long cleanupInterval)
void
setConnectionParameters(ConnectionParameters connectionParameters)
void
setEnableQueue(boolean enableQueue)
void
setIdelLifetime(long idelLifetime)
void
setQueueInterval(long queueInterval)
void
setStackMap(StackMap stackMap)
void
setType(int type)
protected void
setupDriverManager()
void
shutdown()
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:Pool
Create a new, ready-to-use object for the pool- Specified by:
create
in classPool<T extends ConnectionRecord>
- Returns:
- the object
- Throws:
PoolException
-
destroy
public void destroy(T cc) throws PoolException
Description copied from class:Pool
Destroy an object that is no longer needed.- Specified by:
destroy
in classPool<T extends ConnectionRecord>
- Parameters:
cc
- the object- Throws:
PoolException
-
push
public void push(T object) throws PoolException
Description copied from class:Pool
Check an object into the pool. If the pool is at capacity, destroy the object.- Overrides:
push
in classPool<T extends ConnectionRecord>
- Parameters:
object
- the object- Throws:
PoolException
-
pop
public T pop(long timeout) throws PoolException, InterruptedException
- Throws:
PoolException
InterruptedException
-
pop
public T pop() throws PoolException
Description copied from class:Pool
Pop an object off the stack if there is one, otherwise, create one.- Overrides:
pop
in classPool<T extends ConnectionRecord>
- Returns:
- the object
- Throws:
PoolException
-
isValid
public boolean isValid(T t) throws PoolException
Description copied from class:Pool
Is 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:
isValid
in 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.
-
-