Class ConnectionPool
- java.lang.Object
-
- org.apache.manifoldcf.core.jdbcpool.ConnectionPool
-
public class ConnectionPool extends java.lang.ObjectThe class that defines a connection pool.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected intactiveConnectionsprotected booleanclosedprotected long[]connectionCleanupTimeoutsprotected java.lang.StringdbURLprotected booleandebugprotected longexpirationprotected java.sql.Connection[]freeConnectionsprotected intfreePointerprotected java.util.Set<WrappedConnection>outstandingConnectionsprotected java.lang.Stringpasswordprotected java.lang.StringuserName
-
Constructor Summary
Constructors Constructor Description ConnectionPool(java.lang.String dbURL, java.lang.String userName, java.lang.String password, int maxConnections, long expiration, boolean debug)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanupExpiredConnections(long currentTime)Clean up expired connections.voidclosePool()Close down the pool.voidflushPool()Flush the pool.WrappedConnectiongetConnection()Obtain a connection from the pool.protected voidrelease(java.sql.Connection c)voidreleaseConnection(WrappedConnection connection)
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
dbURL
protected final java.lang.String dbURL
-
userName
protected final java.lang.String userName
-
password
protected final java.lang.String password
-
freePointer
protected volatile int freePointer
-
activeConnections
protected volatile int activeConnections
-
closed
protected volatile boolean closed
-
freeConnections
protected final java.sql.Connection[] freeConnections
-
connectionCleanupTimeouts
protected final long[] connectionCleanupTimeouts
-
expiration
protected final long expiration
-
debug
protected final boolean debug
-
outstandingConnections
protected final java.util.Set<WrappedConnection> outstandingConnections
-
-
Method Detail
-
getConnection
public WrappedConnection getConnection() throws java.sql.SQLException, java.lang.InterruptedException
Obtain a connection from the pool. This will wait until a connection is free, if the pool is already completely tapped. The connection is returned by the "close" operation, executed on the connection. (This requires us to wrap the actual connection object).- Throws:
java.sql.SQLExceptionjava.lang.InterruptedException
-
flushPool
public void flushPool()
Flush the pool.
-
closePool
public void closePool()
Close down the pool.
-
cleanupExpiredConnections
public void cleanupExpiredConnections(long currentTime)
Clean up expired connections.
-
releaseConnection
public void releaseConnection(WrappedConnection connection)
-
release
protected void release(java.sql.Connection c)
-
-