public class IfsConnectionPool extends Object implements ConnectionPool
Modifier and Type | Field and Description |
---|---|
protected int |
m_ConnectionPurgeAttempts
The number of times one of the LibraryConnections performed
a statement purge attempt as part of being allocated.
|
protected int |
m_ConnectionStatementPurgeCount
The number of statements purged by LibraryConnections during
purges that occur as part of being allocated.
|
protected DataSource |
m_DataSource
Database connection factory used to make connections to the database
schema.
|
protected int |
m_DefaultRowPrefetch
The default number of prefetched rows.
|
protected int |
m_DeferredAllocationCount
The number of connection allocation requests that were serviced
after wating for an existing LibraryConnection to become available,
either by allocating an existing LibraryConnection (if possible) or
by creating a new LibraryConnection.
|
protected int |
m_FailedAllocationCount
The number of connection allocation requests that failed (throwing
an exception) because no existing LibraryConnection became available
within
m_MaximumSizeTimeout milliseconds and no new
LibraryConnection could be created because the ConnectionPool size
had reached its absolute maximum. |
protected int |
m_ImmediateAllocationCount
The number of connection allocation requests that were serviced
immediately, either by allocating an existing LibraryConnection (if
possible) or by creating a new LibraryConnection.
|
protected PrintStream |
m_JdbcLogStream
The PrintStream to which the JDBC log will be sent,
or null to disable JDBC logging.
|
protected int |
m_MaximumSize
The absolute maximum number of LibraryConnections in this ConnectionPool.
|
protected long |
m_MaximumSizeTimeout
The period of time, in milliseconds, that attempting to acquire a
LibraryConnection will wait before throwing an exception if the
ConnectionPool size has reached its absolute maximum.
|
protected int |
m_MinimumSize
The minimum number of LibraryConnections in this ConnectionPool.
|
protected String |
m_Name
The name of the ConnectionPool.
|
protected S_LibraryService |
m_Service
The S_LibraryService that created this ConnectionPool.
|
protected int |
m_StatementCacheSizeTrigger
The number of statements that need to be cached before a purge
is triggered.
|
protected int |
m_StatementCacheTarget
The target maximum number of statements we wish to keep cached.
|
protected int |
m_StatementResetLimit
Access limit at which statements saved in LibraryConnections will be
closed and re-opened.
|
protected int |
m_TargetSize
The target maximum number of LibraryConnections in this ConnectionPool.
|
protected long |
m_TargetSizeTimeout
The period of time, in milliseconds, that attempting to acquire a
LibraryConnection will wait before creating a new LibraryConnection
if the ConnectionPool size has reached its target maximum.
|
protected long |
m_TotalAllocationTime
The average elapsed time for a successful allocation request, in
milliseconds.
|
Constructor and Description |
---|
IfsConnectionPool()
Constructs an uninitialized IfsConnectionPool.
|
Modifier and Type | Method and Description |
---|---|
LibraryConnection |
acquireLibraryConnection()
Gets a LibraryConnection from this ConnectionPool.
|
protected void |
createLibraryConnection()
Creates a new LibraryConnection and adds it to this ConnectionPool.
|
void |
dispose()
Shuts down this ConnectionPool.
|
void |
dispose(boolean force)
Shuts down this ConnectionPool.
|
ConnectionPoolConfiguration |
getConnectionPoolConfiguration()
Gets the configuration parameters of this ConnectionPool.
|
ConnectionPoolPerformance |
getConnectionPoolPerformance()
Gets the performance information for this ConnectionPool.
|
void |
initialize(S_LibraryService service,
ConnectionPoolConfiguration configuration)
Initializes an IfsConnectionPool.
|
void |
releaseLibraryConnection(LibraryConnection lconn)
Releases the specified LibraryConnection back to this ConnectionPool.
|
void |
resetCachedStatements()
Resets the cached statements in all LibraryConnections.
|
void |
resetStatistics()
Resets the performance statistics of this ConnectionPool.
|
void |
setConnectionPoolConfiguration(ConnectionPoolConfiguration configuration)
Alters the configuration of this ConnectionPool.
|
protected void |
validateConnectionPoolConfiguration(ConnectionPoolConfiguration configuration)
validate connection pool configuration.
|
void |
validateUnallocatedConnections()
Validates the unallocated connections.
|
protected S_LibraryService m_Service
protected String m_Name
protected DataSource m_DataSource
protected PrintStream m_JdbcLogStream
protected int m_DefaultRowPrefetch
protected int m_StatementResetLimit
protected int m_StatementCacheTarget
protected int m_StatementCacheSizeTrigger
protected int m_MinimumSize
protected int m_TargetSize
protected int m_MaximumSize
protected long m_TargetSizeTimeout
protected long m_MaximumSizeTimeout
protected int m_ImmediateAllocationCount
protected int m_DeferredAllocationCount
protected int m_FailedAllocationCount
m_MaximumSizeTimeout
milliseconds and no new
LibraryConnection could be created because the ConnectionPool size
had reached its absolute maximum.protected int m_ConnectionPurgeAttempts
protected int m_ConnectionStatementPurgeCount
protected long m_TotalAllocationTime
public IfsConnectionPool()
public void initialize(S_LibraryService service, ConnectionPoolConfiguration configuration) throws IfsException
Is invoked immediately after construction to provide the service and configuration context for this pool.
initialize
in interface ConnectionPool
service
- the S_LibraryService creating this
ConnectionPoolconfiguration
- the ConnectionPool configuration
parametersIfsException
- (IFS-10620) if the operation failspublic final ConnectionPoolConfiguration getConnectionPoolConfiguration() throws IfsException
This method returns a copy of the configuration parameters for this
ConnectionPool. To alter the configuration of this ConnectionPool,
use the ConnectionPoolConfiguration mutators to adjust the values of
these parameters and then call setConnectionPoolConfiguration
to apply the altered ConnectionPoolConfiguration.
The database URL, schema name, and schema password are not included in the returned parameters.
getConnectionPoolConfiguration
in interface ConnectionPool
IfsException
- (IFS-10628) if the operation failspublic final void setConnectionPoolConfiguration(ConnectionPoolConfiguration configuration) throws IfsException
The following configuration parameters can be changed using this method:
All other configuration parameters specified in the ConnectionPoolConfiguration are ignored.
setConnectionPoolConfiguration
in interface ConnectionPool
configuration
- the configuration parametersIfsException
- (IFS-10629) if the operation failspublic final LibraryConnection acquireLibraryConnection() throws IfsException
acquireLibraryConnection
in interface ConnectionPool
IfsException
- (IFS-10621) if the operation failsprotected final void createLibraryConnection() throws IfsException
IfsException
- (IFS-10633) if the operation failspublic final void releaseLibraryConnection(LibraryConnection lconn) throws IfsException
releaseLibraryConnection
in interface ConnectionPool
lconn
- the connection to releaseIfsException
- (IFS-10622) if the operation failspublic final ConnectionPoolPerformance getConnectionPoolPerformance() throws IfsException
getConnectionPoolPerformance
in interface ConnectionPool
IfsException
- (IFS-10624) if the operation failspublic final void resetStatistics() throws IfsException
resetStatistics
in interface ConnectionPool
IfsException
- (IFS-10625) if the operation failspublic final void validateUnallocatedConnections() throws IfsException
validateUnallocatedConnections
in interface ConnectionPool
IfsException
- if the operation failspublic final void dispose(boolean force) throws IfsException
dispose
in interface ConnectionPool
force
- whether to perform a forced shutdown,
closing in-use connectionsIfsException
- (IFS-10626) if the operation failspublic final void dispose() throws IfsException
Equivalent to dispose(true)
.
dispose
in interface ConnectionPool
dispose
in interface SubService
IfsException
- (IFS-10626) if the operation failspublic final void resetCachedStatements() throws IfsException
resetCachedStatements
in interface ConnectionPool
IfsException
- if the operation failsprotected void validateConnectionPoolConfiguration(ConnectionPoolConfiguration configuration) throws IfsException
IfsException
- if the configuration is not validCopyright © 2023. All rights reserved.