public interface ConnectionPool
Modifier and Type | Interface and Description |
---|---|
static interface |
ConnectionPool.Counter
Facilitates the counting of connection pool events
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this connection pool, connections subsequently checked in are disconnected
|
int |
getCleanupInterval() |
java.sql.Connection |
getConnection()
Fetches a connection from the pool.
|
int |
getConnectionTimeout() |
Database |
getDatabase() |
int |
getMaximumCheckOutTime() |
int |
getMaximumPoolSize() |
int |
getMaximumRetryWaitPeriod() |
int |
getMinimumPoolSize() |
int |
getNewConnectionThreshold() |
ConnectionPoolStatistics |
getStatistics(long since)
Retrives usage statistics for the connection pool since time
since . |
User |
getUser() |
boolean |
isCollectFineGrainedStatistics() |
void |
resetStatistics()
Resets the collected usage statistics
|
void |
returnConnection(java.sql.Connection connection)
Return the given connection to the pool.
|
void |
setCleanupInterval(int poolCleanupInterval) |
void |
setCollectFineGrainedStatistics(boolean value)
Specifies whether or not fine grained usage statistics should be collected.
|
void |
setConnectionTimeout(int timeout) |
void |
setMaximumCheckOutTime(int value) |
void |
setMaximumPoolSize(int value)
Sets the maximum number of connections to keep in this pool.
|
void |
setMaximumRetryWaitPeriod(int maximumRetryWaitPeriod) |
void |
setMinimumPoolSize(int value) |
void |
setNewConnectionThreshold(int value) |
java.sql.Connection getConnection() throws DatabaseException
ConnectionPoolException.NoConnectionAvailable
- in case the maximum check out time is exceededDatabaseException
- in case of a database exceptionjava.lang.IllegalStateException
- if the pool is closedsetMaximumCheckOutTime(int)
void returnConnection(java.sql.Connection connection)
connection
- the database connection to return to the poolDatabase getDatabase()
User getUser()
void close()
ConnectionPoolStatistics getStatistics(long since)
since
.since
- the time from which statistics should be retrievedvoid resetStatistics()
boolean isCollectFineGrainedStatistics()
getStatistics(long)
,
ConnectionPoolStatistics.getFineGrainedStatistics()
void setCollectFineGrainedStatistics(boolean value)
value
- the valuegetStatistics(long)
,
ConnectionPoolStatistics.getFineGrainedStatistics()
int getCleanupInterval()
void setCleanupInterval(int poolCleanupInterval)
poolCleanupInterval
- the pool cleanup interval in millisecondsint getConnectionTimeout()
void setConnectionTimeout(int timeout)
timeout
- the pooled connection timeout in milliseconds, that is, the time that needs
to pass before an idle connection can be harvestedint getMaximumRetryWaitPeriod()
void setMaximumRetryWaitPeriod(int maximumRetryWaitPeriod)
maximumRetryWaitPeriod
- the maximum number of milliseconds the pool waits between checkout retriesint getMinimumPoolSize()
void setMinimumPoolSize(int value)
value
- the minimum number of connections to keep in the pooljava.lang.IllegalArgumentException
- if value is less than 0 or larger than maximum pool sizeint getMaximumPoolSize()
void setMaximumPoolSize(int value)
value
- the maximum number of connections this pool can createjava.lang.IllegalArgumentException
- if value is less than 1 or less than minimum pool sizeint getMaximumCheckOutTime()
ConnectionPoolException.NoConnectionAvailable
void setMaximumCheckOutTime(int value)
value
- the maximum number of milliseconds to retry connection checkout before throwing an exception,
note that this also modifies the new connection threshold, keeping its value to 1/4 of this onejava.lang.IllegalArgumentException
- if value is less than 0int getNewConnectionThreshold()
void setNewConnectionThreshold(int value)
value
- the time to wait before creating a new connection in msjava.lang.IllegalArgumentException
- in case value is negative or larger than maximumCheckOutTime