public interface ConnectionPoolWrapper
Modifier and Type | Field and Description |
---|---|
static PropertyValue<Integer> |
DEFAULT_IDLE_TIMEOUT
Specifies the default idle timeout in milliseconds.
|
static PropertyValue<Integer> |
DEFAULT_MAXIMUM_POOL_SIZE
Specifies the default maximum connection pool size.
|
static PropertyValue<Integer> |
DEFAULT_MINIMUM_POOL_SIZE
Specifies the default minimum connection pool size.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this connection pool, connections subsequently checked in are disconnected
|
Connection |
connection(User user)
Fetches a connection from the pool.
|
int |
getCleanupInterval() |
int |
getIdleConnectionTimeout() |
int |
getMaximumCheckOutTime() |
int |
getMaximumPoolSize() |
int |
getMinimumPoolSize() |
boolean |
isCollectCheckOutTimes() |
boolean |
isCollectSnapshotStatistics() |
DataSource |
poolDataSource() |
void |
resetStatistics()
Resets the collected usage statistics
|
void |
setCleanupInterval(int poolCleanupInterval) |
void |
setCollectCheckOutTimes(boolean collectCheckOutTimes)
Specifies whether to collect connection check out times.
|
void |
setCollectSnapshotStatistics(boolean collectSnapshotStatistics)
Specifies whether to collect usage statistics for a snapshot.
|
void |
setIdleConnectionTimeout(int idleConnectionTimeout) |
void |
setMaximumCheckOutTime(int maximumCheckOutTime) |
void |
setMaximumPoolSize(int maximumPoolSize)
Sets the maximum number of connections to keep in this pool.
|
void |
setMinimumPoolSize(int minimumPoolSize) |
ConnectionPoolStatistics |
statistics(long since)
Retrives usage statistics for the connection pool since time
since . |
User |
user() |
static final PropertyValue<Integer> DEFAULT_MAXIMUM_POOL_SIZE
static final PropertyValue<Integer> DEFAULT_MINIMUM_POOL_SIZE
static final PropertyValue<Integer> DEFAULT_IDLE_TIMEOUT
Connection connection(User user) throws DatabaseException
user
- the user credentialsDatabaseException
- in case of an exception while fetching the connectionIllegalStateException
- if the pool is closedsetMaximumCheckOutTime(int)
,
Connection.close()
User user()
DataSource poolDataSource()
void close()
ConnectionPoolStatistics statistics(long since)
since
.since
- the time from which statistics should be retrievedvoid resetStatistics()
boolean isCollectSnapshotStatistics()
statistics(long)
,
ConnectionPoolStatistics.snapshot()
void setCollectSnapshotStatistics(boolean collectSnapshotStatistics)
collectSnapshotStatistics
- the valuestatistics(long)
,
ConnectionPoolStatistics.snapshot()
boolean isCollectCheckOutTimes()
statistics(long)
void setCollectCheckOutTimes(boolean collectCheckOutTimes)
collectCheckOutTimes
- the valuestatistics(long)
int getCleanupInterval()
void setCleanupInterval(int poolCleanupInterval)
poolCleanupInterval
- the pool cleanup interval in millisecondsint getIdleConnectionTimeout()
void setIdleConnectionTimeout(int idleConnectionTimeout)
idleConnectionTimeout
- the pooled connection timeout in milliseconds, that is, the time that needs
to pass before an idle connection can be harvestedint getMinimumPoolSize()
void setMinimumPoolSize(int minimumPoolSize)
minimumPoolSize
- the minimum number of connections to keep in the poolIllegalArgumentException
- if the value is less than 0 or larger than maximum pool sizeint getMaximumPoolSize()
void setMaximumPoolSize(int maximumPoolSize)
maximumPoolSize
- the maximum number of connections this pool can createIllegalArgumentException
- if the value is less than 1 or less than minimum pool sizeint getMaximumCheckOutTime()
void setMaximumCheckOutTime(int maximumCheckOutTime)
maximumCheckOutTime
- 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 oneIllegalArgumentException
- if the value is less than 0