|
Oracle® Universal Connection Pool Java API Reference 11g Release 1 (11.1) E11990-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UniversalConnectionPool
A connection pool that pools any type of connection (called a physical connection). <p/> There are several key objects that make up the connection pool:
<p/> Physical Pool The physical pool maintains pooled connections that can be borrowed from the pool, returned to the pool, or closed and not returned to the pool. The pool keeps track of the connections that are available (so that they can be borrowed) and connections that are in use (so they can be reaped if it is determined that they are no longer valid). <p/> Connection Factory Adapter The connection pool must rely on another entity to create and close connections because connection pools can pool any type of connection. This is the responsibility of the connection factory adapter. A connection factory adapter is tied to a specific resource (JDBC, JCA, LDAP, etc.). When the connection pool needs to create a new connection, it asks the connection factory adapter to do so. The returned connection is placed inside a UniversalPooledConnection
object that is then placed into the connection pool. When the connection pool closes a connection, it hands the connection to the connection factory adapter which then closes the connection. <p/> Pooled Connections Each pooled connection in the connection pool is an instance of UniversalPooledConnection
. The pooled connection decorates a physical connection (created by the connection factory adapter) which can be borrowed. <p/> Connection Retrieval Info The connection retrieval info object is used by the connection factory adapter to create connections. It contains resource-specific information that the connection factory adapter uses to create connections. For example, the JDBC connection retrieval info object maintains the user and password that are used to create a connection from a JDBC resource. The JCA connection retrieval info object maintains the Subject
and JCA ConnectionRequestInfo object
. <p/> Pool Properties The pool provides some properties for users to customize the pool's behavior, such as:
<p/> Statistics The pool maintains some statistics such as:
<p/> Lifecycle A connection pool has a lifecycle. See UniversalConnectionPoolLifeCycleState
for details. A connection pool is started by calling the start()
method and stopped by calling the stop()
method. Connections may not be borrowed until the connection pool has been started or after the pool has been stopped (unless the pool has been started again). <p/>
UniversalPooledConnection
, ConnectionFactoryAdapter
, ConnectionRetrievalInfo
, UniversalConnectionPoolStatistics
, UniversalConnectionPoolLifeCycleState
Method Summary | |
---|---|
UniversalPooledConnection |
borrowConnection(ConnectionRetrievalInfo connectionRetrievalInfo) Gets a connection from the connection pool. |
void |
closeConnection(UniversalPooledConnection pooledConnection) Closes the pooled connection. |
int |
getAbandonedConnectionTimeout() Gets the abandoned connection timeout value. |
int |
getAvailableConnectionsCount() Gets the number of connections that are available in the connection pool (that is, connections in the pool that are not currently in use by clients). |
int |
getBorrowedConnectionsCount() Gets the number of connections that are actively in use by clients. |
int |
getConnectionHarvestMaxCount() Gets the maximum number of connections that may be harvested when the connection harvesting occurs. |
int |
getConnectionHarvestTriggerCount() Gets the number of available connections below which the connection pool's connection harvesting occurs. |
ConnectionRetrievalInfo |
getConnectionRetrievalInfo() Gets the ConnectionRetrievalInfo object which contains user and password information to create the connections. |
int |
getConnectionWaitTimeout() Gets the amount of time to wait (in seconds) for a used connection to be released by a client. |
int |
getInactiveConnectionTimeout() Gets the inactive connection timeout value. |
int |
getInitialPoolSize() Gets the initial pool size. |
UniversalConnectionPoolLifeCycleState |
getLifeCycleState() Gets the life cycle state of the connection pool. |
int |
getMaxConnectionReuseCount() Gets the maximum connection reuse count property value. |
long |
getMaxConnectionReuseTime() Gets the maximum connection reuse time property value. |
int |
getMaxPoolSize() Gets the maximum number of connections that the connection pool maintains. |
int |
getMinPoolSize() Gets the minimum number of connections that the connection pool maintains. |
java.lang.String |
getName() Gets the name of the connection pool. |
UniversalConnectionPoolStatistics |
getStatistics() Gets the statistics of the connection pool. |
int |
getTimeoutCheckInterval() Gets the frequency (in seconds) to enforce the timeout properties. |
int |
getTimeToLiveConnectionTimeout() Gets the maximum time (in seconds) a connection may remain in-use. |
boolean |
getValidateConnectionOnBorrow() Returns whether or not a connection being borrowed should first be validated. |
void |
purge() Removes all connections from the connection pool. |
void |
reconfigure(java.util.Properties props) Allows a connection pool to be reconfigured gracefully with a different set of properties that specify the behavior of the connection pool at runtime. |
void |
recycle() Allows only invalid available connections in the pool to be replaced with new/fresh connections. |
void |
refresh() Allows connections in the pool, both borrowed and available ones, to be replaced with new/fresh connections. |
void |
registerConnectionAffinityCallback(ConnectionAffinityCallback cbk) Registers a ConnectionAffinityCallback objet on the connection pool. |
void |
registerConnectionLabelingCallback(ConnectionLabelingCallback cbk) Registers a ConnectionLabelingCallback object with this connection pool. |
void |
removeConnectionAffinityCallback() Removes the ConnectionAffinityCallback object registered on the connection pool. |
void |
removeConnectionLabelingCallback() Removes the ConnectionLabelingCallback object registered with this connection pool, if any. |
void |
returnConnection(UniversalPooledConnection pooledConnection) Returns a connection back into the connection pool. |
void |
setAbandonedConnectionTimeout(int abandonedConnectionTimeout) Sets the abandoned connection timeout. |
void |
setConnectionHarvestMaxCount(int connectionHarvestMaxCount) Sets the maximum number of connections that may be harvested when the connection harvesting occurs. |
void |
setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount) Sets the number of available connections below which the connection pool's connection harvesting occurs. |
void |
setConnectionRetrievalInfo(ConnectionRetrievalInfo cri) Sets the ConnectionRetrievalInfo for creating the initial connections (physical conenctions) in the pool based on the initialPoolSize property. |
void |
setConnectionWaitTimeout(int waitTimeout) Sets the amount of time to wait (in seconds) for a used connection to be released by a client. |
void |
setInactiveConnectionTimeout(int inactiveConnectionTimeout) Sets the inactive connection timeout. |
void |
setInitialPoolSize(int initialPoolSize) Sets the initial pool size. |
void |
setMaxConnectionReuseCount(int maxConnectionReuseCount) Sets the maximum connection reuse count property. |
void |
setMaxConnectionReuseTime(long maxConnectionReuseTime) Sets the maximum connection reuse time property. |
void |
setMaxPoolSize(int maxPoolSize) Sets the maximum number of connections. |
void |
setMinPoolSize(int minPoolSize) Sets the minimum number of connections. |
void |
setName(java.lang.String name) Sets the name of the connection pool. |
void |
setTimeoutCheckInterval(int timeoutCheckInterval) Sets the frequency (in seconds) to enforce the timeout properties. |
void |
setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) Sets the maximum time (in seconds) a connection may remain in-use. |
void |
setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow) Sets whether or not a connection being borrowed should first be validated. |
void |
start() Starts the connection pool. |
void |
stop() Stops the connection pool. |
Method Detail |
---|
UniversalPooledConnection borrowConnection(ConnectionRetrievalInfo connectionRetrievalInfo) throws UniversalConnectionPoolException
connectionRetrievalInfo
- Info to use to get the connection.UniversalConnectionPoolException
- if an error occurs getting a connection.NoAvailableConnectionsException
- if all of the connections are in use.void returnConnection(UniversalPooledConnection pooledConnection) throws UniversalConnectionPoolException
pooledConnection
- The connection to return back into the pool.UniversalConnectionPoolException
void closeConnection(UniversalPooledConnection pooledConnection) throws UniversalConnectionPoolException
pooledConnection
- The pooled connection to close.UniversalConnectionPoolException
- if an error occurs closing the connection.void refresh() throws UniversalConnectionPoolException
UniversalConnectionPoolException
void recycle() throws UniversalConnectionPoolException
UniversalConnectionPoolException
void purge() throws UniversalConnectionPoolException
refresh()
is that the connection pool is left empty with no connections available after calling purge()
. Some of the connection pool properties such as minPoolSize
or initialPoolSize
may not be honored when purging connections from the pool. <p/> Note that both borrowed and available connections are removed when this API is called. Any borrowed connections incur an exception after this API is called. The user is expected to retry and obtain a new connection from the pool.UniversalConnectionPoolException
void reconfigure(java.util.Properties props) throws UniversalConnectionPoolException
props
- Containing new set of pool properties for reconfigurationUniversalConnectionPoolException
void start() throws UniversalConnectionPoolException
UniversalConnectionPoolException
- If an error occurs during start.void stop() throws UniversalConnectionPoolException
UniversalConnectionPoolException
java.lang.String getName()
void setName(java.lang.String name)
name
- The name of the connection pool.int getInitialPoolSize()
void setInitialPoolSize(int initialPoolSize) throws UniversalConnectionPoolException
initialPoolSize
- the initial pool size.UniversalConnectionPoolException
int getMinPoolSize()
void setMinPoolSize(int minPoolSize) throws UniversalConnectionPoolException
minPoolSize
- The minimum number of connections.UniversalConnectionPoolException
int getMaxPoolSize()
void setMaxPoolSize(int maxPoolSize) throws UniversalConnectionPoolException
maxPoolSize
- The maximum number of connections.UniversalConnectionPoolException
int getInactiveConnectionTimeout()
void setInactiveConnectionTimeout(int inactiveConnectionTimeout) throws UniversalConnectionPoolException
inactiveConnectionTimeout
- The inactive connection timeout (in seconds).UniversalConnectionPoolException
int getAbandonedConnectionTimeout()
void setAbandonedConnectionTimeout(int abandonedConnectionTimeout) throws UniversalConnectionPoolException
abandonedConnectionTimeout
- The value of how long a connection has not been used before it is abandoned (in seconds).UniversalConnectionPoolException
int getConnectionWaitTimeout()
void setConnectionWaitTimeout(int waitTimeout) throws UniversalConnectionPoolException
waitTimeout
- The amount of time to wait.UniversalConnectionPoolException
int getTimeToLiveConnectionTimeout()
void setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) throws UniversalConnectionPoolException
timeToLiveConnectionTimeout
- The maximum time (in seconds) a used connection may be active.UniversalConnectionPoolException
int getTimeoutCheckInterval()
abandonedConnectionTimeout
, inactiveConnectionTimeout
, and timeToLiveConnectionTimeout
.void setTimeoutCheckInterval(int timeoutCheckInterval) throws UniversalConnectionPoolException
timeoutCheckInterval
- The frequency (in seconds) to enforce the timeout properties.UniversalConnectionPoolException
boolean getValidateConnectionOnBorrow()
true
, connection validity is performed before returning the connection to the user.void setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow)
validateConnectionOnBorrow
- Whether or not a connection being borrowed should first be validated.int getConnectionHarvestTriggerCount()
void setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount) throws UniversalConnectionPoolException
connectionHarvestTriggerCount
- The number of available connections below which the connection pool's connection harvesting occurs.UniversalConnectionPoolException
int getConnectionHarvestMaxCount()
connectionHarvestMaxCount
.void setConnectionHarvestMaxCount(int connectionHarvestMaxCount) throws UniversalConnectionPoolException
connectionHarvestMaxCount
- the maximum number of connections that may be harvested when the connection harvesting occurs.UniversalConnectionPoolException
int getAvailableConnectionsCount()
int getBorrowedConnectionsCount()
UniversalConnectionPoolStatistics getStatistics()
UniversalConnectionPoolLifeCycleState getLifeCycleState()
ConnectionRetrievalInfo getConnectionRetrievalInfo()
ConnectionRetrievalInfo
object which contains user and password information to create the connections.ConnectionRetrievalInfo
object which contains user and password information to create the connections.void setConnectionRetrievalInfo(ConnectionRetrievalInfo cri)
ConnectionRetrievalInfo
for creating the initial connections (physical conenctions) in the pool based on the initialPoolSize property.cri
- The ConnectionRetrievalInfo
with user and password for creating the initial connections in the pool.void registerConnectionAffinityCallback(ConnectionAffinityCallback cbk) throws UniversalConnectionPoolException
ConnectionAffinityCallback
objet on the connection pool.cbk
- The affinity callback object to be registeredUniversalConnectionPoolException
- If callback registration fails.void removeConnectionAffinityCallback() throws UniversalConnectionPoolException
ConnectionAffinityCallback
object registered on the connection pool.UniversalConnectionPoolException
- If callback removal fails.void registerConnectionLabelingCallback(ConnectionLabelingCallback cbk) throws UniversalConnectionPoolException
ConnectionLabelingCallback
object with this connection pool.cbk
- The ConnectionLabelingCallback
object to be registered.UniversalConnectionPoolException
- If there is a callback already registered with this pool.void removeConnectionLabelingCallback() throws UniversalConnectionPoolException
ConnectionLabelingCallback
object registered with this connection pool, if any.UniversalConnectionPoolException
- If callback removal fails.long getMaxConnectionReuseTime()
setMaxConnectionReuseTime()
.void setMaxConnectionReuseTime(long maxConnectionReuseTime) throws UniversalConnectionPoolException
maxConnectionReuseTime
- Maximum connection reuse time (in seconds)UniversalConnectionPoolException
int getMaxConnectionReuseCount()
setMaxConnectionReuseCount()
.void setMaxConnectionReuseCount(int maxConnectionReuseCount) throws UniversalConnectionPoolException
maxConnectionReuseCount
- Maximum connection reuse countUniversalConnectionPoolException
|
Oracle® Universal Connection Pool Java API Reference 11g Release 1 (11.1) E11990-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |