Class ConnectionPool
- java.lang.Object
-
- org.apache.manifoldcf.core.jdbcpool.ConnectionPool
-
public class ConnectionPool extends java.lang.Object
The class that defines a connection pool.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
_rcsid
protected int
activeConnections
protected boolean
closed
protected long[]
connectionCleanupTimeouts
protected java.lang.String
dbURL
protected boolean
debug
protected long
expiration
protected java.sql.Connection[]
freeConnections
protected int
freePointer
protected java.util.Set<WrappedConnection>
outstandingConnections
protected java.lang.String
password
protected java.lang.String
userName
-
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 void
cleanupExpiredConnections(long currentTime)
Clean up expired connections.void
closePool()
Close down the pool.void
flushPool()
Flush the pool.WrappedConnection
getConnection()
Obtain a connection from the pool.protected void
release(java.sql.Connection c)
void
releaseConnection(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.SQLException
java.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)
-
-