Class PooledConnectionMgr
java.lang.Object
fc.jdbc.ConnectionMgr
fc.jdbc.PooledConnectionMgr
A pooled connection manager. Connections must be closed when done
with, which automatically returns them back to the pool.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longIf a connection cannot be obtained within this time, then a warning will be logged.static final int -
Constructor Summary
ConstructorsConstructorDescriptionPooledConnectionMgr(SystemLog log, PropertyMgr props, int size) Constructs a new connection pool with the specified size.PooledConnectionMgr(SystemLog log, PropertyMgr props, String prefix, int size) Constructs a new connection pool with the specified size.PooledConnectionMgr(PropertyMgr props, int size) Constructs a new connection pool with the specified size.PooledConnectionMgr(PropertyMgr props, String prefix, int size) Constructs a new connection pool with the specified size.PooledConnectionMgr(String jdbc_url, String jdbc_driver, String jdbc_user, String jdbc_password, String jdbc_catalog, int size) Constructs a new connection pool with the specified size. -
Method Summary
Modifier and TypeMethodDescriptionReturns a iterator over a collection of Exception objects, each containing a stack trace for code that has currently checked out a connection from this pool.getHungTransactions(long milliseconds) Gets a list of connections in the pool such that each connection has a transaction that was started more than the specified milliseconds ago but has not yet been aborted or commited (this is a good way to see if there is a transaction leak somewhere).static voidvoidsetDebugCheckout(boolean dbg) Helps to debug connection checkouts.toString()Methods inherited from class ConnectionMgr
close, getConnection, getDBName, getDriver, getURL, setCatalog
-
Field Details
-
defaultSize
- See Also:
-
ConnectionTimeoutWarning
If a connection cannot be obtained within this time, then a warning will be logged. The value is in milliseconds.- See Also:
-
-
Constructor Details
-
PooledConnectionMgr
-
PooledConnectionMgr
Constructs a new connection pool with the specified size. The size is the number of connections that this pool holds.- Throws:
Exception
-
PooledConnectionMgr
Constructs a new connection pool with the specified size. The size is the number of connections that this pool holds.- Throws:
Exception
-
PooledConnectionMgr
Constructs a new connection pool with the specified size. The size is the number of connections that this pool holds.- Throws:
Exception
-
PooledConnectionMgr
public PooledConnectionMgr(SystemLog log, PropertyMgr props, String prefix, int size) throws Exception Constructs a new connection pool with the specified size. The size is the number of connections that this pool holds.- Throws:
Exception
-
-
Method Details
-
setDebugCheckout
Helps to debug connection checkouts. By default, this is false (since there is a stack trace overhead per connection when debugging is enabled).- Parameters:
dbg- true to enable tracking of checked out connections from this pool. false stops tracking and clears any existing tracking info.
-
getCheckoutInfo
Returns a iterator over a collection of Exception objects, each containing a stack trace for code that has currently checked out a connection from this pool. For this to work, make sure thatsetDebugCheckout(boolean)has first been invoked with true. -
getHungTransactions
Gets a list of connections in the pool such that each connection has a transaction that was started more than the specified milliseconds ago but has not yet been aborted or commited (this is a good way to see if there is a transaction leak somewhere). -
toString
- Overrides:
toStringin classConnectionMgr
-
main
-