Interface UniversalConnectionPoolMBean
-
public interface UniversalConnectionPoolMBeanThe Universal Connection Pool MBean defines operations and attributes for managing the Universal Connection Pool. The MBean is always associated with a pool instance. Remote users can get access to these operations and attributes using JMX operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.lang.IntegergetAbandonedConnectionsCount()Gets the number of abandoned connections that have been reclaimed.java.lang.IntegergetAbandonedConnectionTimeout()Gets the abandoned connection timeout of the Universal Connection Pool instance.java.lang.IntegergetAvailableConnectionsCount()Gets the available connections count of the Universal Connection Pool instance.java.lang.IntegergetAverageBorrowedConnectionsCount()Gets the average number of connections that are borrowed and actively in use by clients.java.lang.LonggetAverageConnectionWaitTime()Gets the average time (in milliseconds) a user thread has to wait before it could obtain a connection from the connection pool.java.lang.IntegergetBorrowedConnectionsCount()Gets the borrowed connections count of the Universal Connection Pool instance.java.lang.IntegergetBufferSize()Get in-memory trace buffer size.java.lang.StringgetColocationStats()Get processing info for COLOCATION_TAG support.java.lang.IntegergetConnectionHarvestMaxCount()Gets the connection harvest maximum count of the Universal Connection Pool instance.java.lang.IntegergetConnectionHarvestTriggerCount()Gets the connection harvest trigger count of the Universal Connection Pool instance.java.lang.LonggetConnectionRepurposeCount()Returns the number of connection repurposed in a shared pool for a mutitenant database, where connections can be reused across PDB's by switching their container and PDB service.java.lang.IntegergetConnectionsClosedCount()Gets the number of connections closed by this connection pool.java.lang.IntegergetConnectionsCreatedCount()Gets the number of connections created for this connection pool.java.lang.IntegergetConnectionValidationTimeout()Connection validation timeout getterjava.time.DurationgetConnectionWaitDuration()Returns how much time a connection request call may wait before it either successfully returns a connection or throws an exception.java.lang.IntegergetConnectionWaitTimeout()Deprecated.java.lang.LonggetCumulativeConnectionBorrowedCount()Gets the number of connections borrowed from the connection pool over the life of the pool.java.lang.LonggetCumulativeConnectionReturnedCount()Gets the number of connections returned to the connection pool over the life of the pool.java.lang.LonggetCumulativeConnectionUseTime()Gets the cumulative time (in milliseconds) of connections that were borrowed from the pool and remained in use.java.lang.LonggetCumulativeConnectionWaitTime()Gets the cumulative time (in milliseconds) that connection requests have waited for connections over the life of the connection pool.java.lang.LonggetCumulativeFailedConnectionWaitCount()Gets the number of connection requests that waited unsuccessfully to borrow a connection from the pool.java.lang.LonggetCumulativeFailedConnectionWaitTime()Gets the cumulative time (in milliseconds) that connection requests waited but failed to borrow a connection from the pool.java.lang.LonggetCumulativeSuccessfulConnectionWaitCount()Gets the number of connection requests that waited successfully and borrowed a connection from the pool.java.lang.LonggetCumulativeSuccessfulConnectionWaitTime()Gets the cumulative time (in milliseconds) that connection requests waited successfully and borrowed a connection from the pool.java.lang.LonggetFailedAffinityBasedBorrowCount()Gets the number of borrow requests that returned connections not matching the affinity contexts.java.lang.LonggetFailedRCLBBasedBorrowCount()Gets the number of borrow requests failed using Runtime Connection Load-Balancing (RCLB) algorithms.java.lang.StringgetFcfProcessingInfo()Gets the information of recent Fast Connection Failover (FCF) attempts, in the form of a String.java.lang.StringgetFcfProcessingInfoProcessedOnly()java.lang.IntegergetInactiveConnectionTimeout()Gets the inactive connection timeout of the Universal Connection Pool instance.java.lang.IntegergetInitialPoolSize()Gets the initial pool size of the Universal Connection Pool instance.java.lang.IntegergetLabeledConnectionsCount()Gets the number of labeled connections in the connection pool.java.lang.StringgetLifeCycleState()Gets the lifecycle state of Universal Connection Pool instance.java.lang.BooleangetLoggingEnabled()java.util.logging.LevelgetLogLevel()Get a current logging level.java.lang.StringgetLogLevelStr()java.lang.IntegergetMaxConnectionReuseCount()Gets the maximum connection reuse count of the Universal Connection Pool instance.java.lang.LonggetMaxConnectionReuseTime()Gets the maximum connection reuse time of the Universal Connection Pool instance.java.lang.IntegergetMaxPoolSize()Gets the maximum pool size of the Universal Connection Pool instance.javax.management.modelmbean.ModelMBeanInfogetMBeanInfo(javax.management.ObjectName mbeanObjName, java.lang.String mbeanDisplayName)BuildsMBeanInfoto define attributes, constructors, operations and notifications to expose to the remote users.java.lang.IntegergetMinIdle()Gets the minimum idle connections of the Universal Connection Pool instance.java.lang.IntegergetMinPoolSize()Gets the minimum pool size of the Universal Connection Pool instance.java.lang.StringgetName()Gets the name of the Universal Connection Pool instance.default java.lang.IntegergetPeakBorrowedConnectionsCount()Gets the maximum number of borrowed connections that the connection pool has reached during the life of the pool.java.lang.IntegergetPeakConnectionsCount()Gets the maximum number of connections that the connection pool has reached during the life of the pool.java.lang.LonggetPeakConnectionWaitTime()Gets the longest wait (in milliseconds) a user request has to incur before obtaining a connection from the connection pool.java.lang.IntegergetPendingRequestsCount()Gets the number of clients that are currently waiting to obtain a connection from the pool.java.lang.IntegergetRemainingPoolCapacityCount()Gets the number of connections that may be added to the pool before it reachesmaxPoolSize.java.lang.IntegergetSecondsToTrustIdleConnection()Gets the seconds To Trust Idle Connection value.java.lang.StringgetShardConnectionStats()Returns total, borrowed and available connection counts to various shards discovered by the pool so far.java.lang.BooleangetShardingMode()Returns the mode of UCP when UCP is using a Sharded Database.java.lang.StringgetStatistics()Gets statistics for the Universal Connection Pool instance.java.lang.LonggetSuccessfulAffinityBasedBorrowCount()Gets the number of borrow requests succeeded with matching affinity contexts.java.lang.LonggetSuccessfulRCLBBasedBorrowCount()Gets the number of borrow requests succeeded using Runtime Connection Load-Balancing (RCLB) algorithms.java.lang.IntegergetTimeoutCheckInterval()Gets the timeout check interval of the Universal Connection Pool instance.java.lang.IntegergetTimeToLiveConnectionTimeout()Gets the time to live connection timeout of the Universal Connection Pool instance.java.lang.IntegergetTotalConnectionsCount()Gets the total number of connections (both available and borrowed) in the connection pool.java.lang.BooleangetTraceEnabled()javax.management.modelmbean.ModelMBeanAttributeInfo[]getUCPMBeanAttributes()Builds the attribute information for the Universal Connection Pool MBean.javax.management.modelmbean.ModelMBeanOperationInfo[]getUCPMBeanOperations()Builds the operation information for the Universal Connection Pool MBean.java.lang.BooleangetValidateConnectionOnBorrow()Gets the validate connection on borrow value of the Universal Connection Pool instance.java.lang.BooleanisCreateConnectionInBorrowThread()Returns the connection creation mode: either "true" if connections are created using the borrowing thread, or "false" if connections are created in the background (the default).java.lang.BooleanisReadOnlyInstanceAllowed()Returns true if the connection borrow is allowed to a read-only instance, false otherwise.voidpurge()Purges the Universal Connection Pool instance.voidrecycle()Recycles the Universal Connection Pool instance.voidrefresh()Refreshes the Universal Connection Pool instance.voidsetAbandonedConnectionTimeout(java.lang.Integer abandonedConnectionTimeout)Sets the abandoned connection timeout of the Universal Connection Pool instance.voidsetBufferSize(java.lang.Integer bufferSize)Set in-memory trace buffer size.voidsetConnectionHarvestMaxCount(java.lang.Integer connectionHarvestMaxCount)Sets the connection harvest maximum count for the Universal Connection Pool instance.voidsetConnectionHarvestTriggerCount(java.lang.Integer connectionHarvestTriggerCount)Sets the connection harvest trigger count for the Universal Connection Pool instance.voidsetConnectionValidationTimeout(java.lang.Integer connectionValidationTimeout)Connection validation timeout settervoidsetConnectionWaitDuration(java.time.Duration connectionWaitDuration)Configures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.voidsetConnectionWaitTimeout(java.lang.Integer connectionWaitTimeout)Deprecated.voidsetCreateConnectionInBorrowThread(java.lang.Boolean createConnectionInBorrowThread)Set this flag to true to make UCP use the borrowing thread to create new connections.voidsetInactiveConnectionTimeout(java.lang.Integer inactiveConnectionTimeout)Sets the inactive connection timeout.voidsetInitialPoolSize(java.lang.Integer initialPoolSize)Sets the initial pool size of the Universal Connection Pool instance.voidsetLoggingEnabled(java.lang.Boolean enabled)Enable or disable logging.voidsetLogLevel(java.util.logging.Level logLevel)Set a current logging level.voidsetLogLevelStr(java.lang.String logLevel)voidsetMaxConnectionReuseCount(java.lang.Integer maxConnectionReuseCount)Sets the maximum connection reuse count for the Universal Connection Pool instance.voidsetMaxConnectionReuseTime(java.lang.Long maxConnectionReuseTime)Sets the maximum connection reuse time for the Universal Connection Pool instance.voidsetMaxPoolSize(java.lang.Integer maxPoolSize)Sets the maximum pool size of the Universal Connection Pool instance.voidsetMinIdle(java.lang.Integer minIdle)Sets the minimum idle connections of the Universal Connection Pool instance.voidsetMinPoolSize(java.lang.Integer minPoolSize)Sets the minimum pool size of the Universal Connection Pool instance.voidsetName(java.lang.String name)Sets the name of the Universal Connection Pool instance.voidsetReadOnlyInstanceAllowed(java.lang.Boolean readOnlyInstanceAllowed)Sets the read-only instance allowed value on the datasource.voidsetSecondsToTrustIdleConnection(java.lang.Integer secondsToTrustIdleConnection)Sets the time in seconds to trust an idle connection to skip a validation test.voidsetShardingMode(java.lang.Boolean shardingMode)This API changes the mode of UCP when UCP is using a Sharded Database.voidsetTimeoutCheckInterval(java.lang.Integer timeoutCheckInterval)Sets the timeout check interval of the Universal Connection Pool instance.voidsetTimeToLiveConnectionTimeout(java.lang.Integer timeToLiveConnectionTimeout)Sets the time to live connection timeout of the Universal Connection Pool instance.voidsetTraceEnabled(java.lang.Boolean enabled)Enable or disable tracing.voidsetValidateConnectionOnBorrow(java.lang.Boolean validateConnectionOnBorrow)Makes the pool validate the connection before returning it to the user by calling the JDBC API "isValid".voidstart()Starts the Universal Connection Pool instance.voidstop()Stops the Universal Connection Pool instance.voiduseStrictWebSessionAffinity(java.lang.Boolean strict)The knob for switching strict web session affinityvoiduseStrictXAAffinity(java.lang.Boolean strict)The knob for switching strict XA affinity
-
-
-
Method Detail
-
refresh
void refresh() throws UniversalConnectionPoolExceptionRefreshes the Universal Connection Pool instance.- Throws:
UniversalConnectionPoolException- If an error occurs while refreshing the Universal Connection Pool instance.
-
recycle
void recycle() throws UniversalConnectionPoolExceptionRecycles the Universal Connection Pool instance.- Throws:
UniversalConnectionPoolException- If an error occurs while recycling the Universal Connection Pool instance.
-
purge
void purge() throws UniversalConnectionPoolExceptionPurges the Universal Connection Pool instance.- Throws:
UniversalConnectionPoolException- If an error occurs while purging the Universal Connection Pool instance.
-
start
void start() throws UniversalConnectionPoolExceptionStarts the Universal Connection Pool instance.- Throws:
UniversalConnectionPoolException- If an error occurs while starting the Universal Connection Pool instance.
-
stop
void stop() throws UniversalConnectionPoolException
Stops the Universal Connection Pool instance.- Throws:
UniversalConnectionPoolException- If an error occurs while stopping the Universal Connection Pool instance.
-
getName
java.lang.String getName()
Gets the name of the Universal Connection Pool instance.- Returns:
- String Returns the name.
-
setName
void setName(java.lang.String name) throws UniversalConnectionPoolExceptionSets the name of the Universal Connection Pool instance.- Parameters:
name- A new name for the Universal Connection Pool instance.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the name.
-
getInitialPoolSize
java.lang.Integer getInitialPoolSize()
Gets the initial pool size of the Universal Connection Pool instance.- Returns:
- The initial pool size.
-
setInitialPoolSize
void setInitialPoolSize(java.lang.Integer initialPoolSize) throws UniversalConnectionPoolExceptionSets the initial pool size of the Universal Connection Pool instance.- Parameters:
initialPoolSize- New initial pool size.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the initial pool size.
-
getMinPoolSize
java.lang.Integer getMinPoolSize()
Gets the minimum pool size of the Universal Connection Pool instance.- Returns:
- The minimum pool size.
-
setMinPoolSize
void setMinPoolSize(java.lang.Integer minPoolSize) throws UniversalConnectionPoolExceptionSets the minimum pool size of the Universal Connection Pool instance. The default is 1 connection.- Parameters:
minPoolSize- New minimum pool size.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the minimum pool.
-
getMinIdle
java.lang.Integer getMinIdle()
Gets the minimum idle connections of the Universal Connection Pool instance.- Returns:
- The minimum idle connections.
-
setMinIdle
void setMinIdle(java.lang.Integer minIdle) throws UniversalConnectionPoolExceptionSets the minimum idle connections of the Universal Connection Pool instance. The default is 0.- Parameters:
minIdle- New minimum idle pool size.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the minimum idle.
-
getMaxPoolSize
java.lang.Integer getMaxPoolSize()
Gets the maximum pool size of the Universal Connection Pool instance.- Returns:
- The maximum pool size.
-
setMaxPoolSize
void setMaxPoolSize(java.lang.Integer maxPoolSize) throws UniversalConnectionPoolExceptionSets the maximum pool size of the Universal Connection Pool instance. The default value is Integer.MAX_VALUE.- Parameters:
maxPoolSize- New maximum pool size.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the maximum pool size.
-
getInactiveConnectionTimeout
java.lang.Integer getInactiveConnectionTimeout()
Gets the inactive connection timeout of the Universal Connection Pool instance.- Returns:
- The inactive connection timeout.
-
setInactiveConnectionTimeout
void setInactiveConnectionTimeout(java.lang.Integer inactiveConnectionTimeout) throws UniversalConnectionPoolExceptionSets the inactive connection timeout.This property's behaviour is affected by the system property
oracle.ucp.timersAffectAllConnections. For more details go to -PoolDataSource.SYSTEM_PROPERTY_TIMERS_AFFECT_ALL_CONNECTIONS.- Parameters:
inactiveConnectionTimeout- New inactive connection timeout.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the inactive connection timeout.
-
getAbandonedConnectionTimeout
java.lang.Integer getAbandonedConnectionTimeout()
Gets the abandoned connection timeout of the Universal Connection Pool instance.- Returns:
- The abandoned connection timeout.
-
setAbandonedConnectionTimeout
void setAbandonedConnectionTimeout(java.lang.Integer abandonedConnectionTimeout) throws UniversalConnectionPoolExceptionSets the abandoned connection timeout of the Universal Connection Pool instance.- Parameters:
abandonedConnectionTimeout- New abandoned connection timeout.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the abandoned connection timeout.
-
getConnectionWaitTimeout
@Deprecated java.lang.Integer getConnectionWaitTimeout()
Deprecated.Returns how much time a connection request call may wait before it either successfully returns a connection or throws an exception.
This method is deprecated. Use
getConnectionWaitDuration()instead.- Returns:
- The connection wait timeout.
-
setConnectionWaitTimeout
@Deprecated void setConnectionWaitTimeout(java.lang.Integer connectionWaitTimeout) throws UniversalConnectionPoolExceptionDeprecated.Configures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.
The wait timeout starts from the point when a connection borrow request is submitted to the pool.
By default, the connection wait timeout is set to 3 seconds.
Setting the connection wait timeout to 0 makes UCP throw an exception immediately if there is no connection available and no room to grow the pool. Note that it still allows UCP to create a new connection if the maximum size hasn't been reached, and that may take some time.
- Throws:
UniversalConnectionPoolException
-
getConnectionWaitDuration
java.time.Duration getConnectionWaitDuration()
Returns how much time a connection request call may wait before it either successfully returns a connection or throws an exception.
A borrow request may end up creating a new JDBC connection. Therefore, starting in 23.1, the value returned by this method may be larger than the configured one because UCP adjusts it so that it's always equal or larger than the CONNECT_TIMEOUT of the JDBC driver.
- Returns:
- The connection wait duration.
- See Also:
setConnectionWaitDuration(java.time.Duration)
-
setConnectionWaitDuration
void setConnectionWaitDuration(java.time.Duration connectionWaitDuration) throws UniversalConnectionPoolExceptionConfigures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.
The wait duration starts from the point when a connection borrow request is submitted to the pool.
During this time, UCP may either return a connection that's currently available in the pool (ideal scenario) or create a new connection if the pool hasn't reached its maximum size. Otherwise, UCP waits for a connection to be returned to the pool.
By default, the connection wait timeout is set to 3 seconds.
Setting the connection wait timeout to
Duration.ZEROmakes UCP throw an exception immediately if there is no connection available and no room to grow the pool. Note that it still allows UCP to create a new connection if the maximum size hasn't been reached, and that may take some time.- Parameters:
connectionWaitDuration- The duration for a connection request to wait.- Throws:
UniversalConnectionPoolException- in case it was not possible to set timeout.
-
getTimeToLiveConnectionTimeout
java.lang.Integer getTimeToLiveConnectionTimeout()
Gets the time to live connection timeout of the Universal Connection Pool instance.- Returns:
- The time to live connection timeout.
-
setTimeToLiveConnectionTimeout
void setTimeToLiveConnectionTimeout(java.lang.Integer timeToLiveConnectionTimeout) throws UniversalConnectionPoolExceptionSets the time to live connection timeout of the Universal Connection Pool instance.- Parameters:
timeToLiveConnectionTimeout- New time to live connection timeout.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the time to live connection timeout.
-
getTimeoutCheckInterval
java.lang.Integer getTimeoutCheckInterval()
Gets the timeout check interval of the Universal Connection Pool instance.- Returns:
- The timeout check interval.
-
setTimeoutCheckInterval
void setTimeoutCheckInterval(java.lang.Integer timeoutCheckInterval) throws UniversalConnectionPoolExceptionSets the timeout check interval of the Universal Connection Pool instance.- Parameters:
timeoutCheckInterval- New timeout check interval.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the timeout check interval.
-
getValidateConnectionOnBorrow
java.lang.Boolean getValidateConnectionOnBorrow()
Gets the validate connection on borrow value of the Universal Connection Pool instance.- Returns:
- The validate connection on borrow value.
-
setValidateConnectionOnBorrow
void setValidateConnectionOnBorrow(java.lang.Boolean validateConnectionOnBorrow)
Makes the pool validate the connection before returning it to the user by calling the JDBC API "isValid".
Validating the connection each time it's borrowed from the pool has a performance cost because it typically requires a full roundtrip to the database. You can tune how the Oracle JDBC thin driver validates connections using the "oracle.jdbc.defaultConnectionValidation" property (please refer to the JDBC driver javadoc). You may also configure "secondsToTrustIdleConnection" to avoid validating connections that are often active.
Default value is false.- Parameters:
validateConnectionOnBorrow- New validate connection on borrow value.- See Also:
setSecondsToTrustIdleConnection(java.lang.Integer)
-
getConnectionHarvestTriggerCount
java.lang.Integer getConnectionHarvestTriggerCount()
Gets the connection harvest trigger count of the Universal Connection Pool instance.- Returns:
- The connection harvest trigger count.
-
setConnectionHarvestTriggerCount
void setConnectionHarvestTriggerCount(java.lang.Integer connectionHarvestTriggerCount) throws UniversalConnectionPoolExceptionSets the connection harvest trigger count for the Universal Connection Pool instance.- Parameters:
connectionHarvestTriggerCount- New connection harvest trigger count.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the connection harvest trigger count.
-
getConnectionHarvestMaxCount
java.lang.Integer getConnectionHarvestMaxCount()
Gets the connection harvest maximum count of the Universal Connection Pool instance.- Returns:
- The connection harvest maximum count.
-
setConnectionHarvestMaxCount
void setConnectionHarvestMaxCount(java.lang.Integer connectionHarvestMaxCount) throws UniversalConnectionPoolExceptionSets the connection harvest maximum count for the Universal Connection Pool instance.- Parameters:
connectionHarvestMaxCount- New connection harvest maximum count.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the connection harvest maximum count.
-
getMaxConnectionReuseTime
java.lang.Long getMaxConnectionReuseTime()
Gets the maximum connection reuse time of the Universal Connection Pool instance.- Returns:
- The maximum connection reuse time.
-
setMaxConnectionReuseTime
void setMaxConnectionReuseTime(java.lang.Long maxConnectionReuseTime) throws UniversalConnectionPoolExceptionSets the maximum connection reuse time for the Universal Connection Pool instance.This property's behaviour is affected by the system property
oracle.ucp.timersAffectAllConnections. For more details go to -PoolDataSource.SYSTEM_PROPERTY_TIMERS_AFFECT_ALL_CONNECTIONS.- Parameters:
maxConnectionReuseTime- New maximum connection reuse time (in seconds).- Throws:
UniversalConnectionPoolException- If an error occurs while changing the maximum connection reuse time.
-
getMaxConnectionReuseCount
java.lang.Integer getMaxConnectionReuseCount()
Gets the maximum connection reuse count of the Universal Connection Pool instance.- Returns:
- The maximum connection reuse count.
-
setMaxConnectionReuseCount
void setMaxConnectionReuseCount(java.lang.Integer maxConnectionReuseCount) throws UniversalConnectionPoolExceptionSets the maximum connection reuse count for the Universal Connection Pool instance.- Parameters:
maxConnectionReuseCount- New maximum connection reuse count.- Throws:
UniversalConnectionPoolException- If an error occurs while changing the maximum connection reuse count.
-
setShardingMode
void setShardingMode(java.lang.Boolean shardingMode)
This API changes the mode of UCP when UCP is using a Sharded Database. By default UCP requires the caller to provide a sharding key for every connection request. When switching off the sharding mode, UCP behaves like a regular connection pool and all the sharding features are disabled so that a caller can request a connection without providing any sharding key.- Parameters:
shardingMode- Mode of UCP when using a Sharded Database.
-
getShardingMode
java.lang.Boolean getShardingMode()
Returns the mode of UCP when UCP is using a Sharded Database. By default sharding mode is ON which means UCP requires the caller to provide a sharding key for every connection request.- Returns:
- Mode of UCP when using a Sharded Database.
-
setConnectionValidationTimeout
void setConnectionValidationTimeout(java.lang.Integer connectionValidationTimeout) throws UniversalConnectionPoolExceptionConnection validation timeout setter- Parameters:
connectionValidationTimeout- timeout to set- Throws:
UniversalConnectionPoolException- in case of inability to set timeout.
-
getConnectionValidationTimeout
java.lang.Integer getConnectionValidationTimeout()
Connection validation timeout getter- Returns:
- the current connection validation timaout value in seconds
-
isCreateConnectionInBorrowThread
java.lang.Boolean isCreateConnectionInBorrowThread()
Returns the connection creation mode: either "true" if connections are created using the borrowing thread, or "false" if connections are created in the background (the default).- Returns:
- true, if creating connections in a borrow thread, false otherwise.
- See Also:
setCreateConnectionInBorrowThread(java.lang.Boolean)
-
setCreateConnectionInBorrowThread
void setCreateConnectionInBorrowThread(java.lang.Boolean createConnectionInBorrowThread)
Set this flag to true to make UCP use the borrowing thread to create new connections. By default, connections are created in the background. The only reason why you may want to set this to "true" is to make a connection request fail-fast if the driver throws an exception while connecting; otherwise, the background task will keep trying until the connection wait timeout expires.
If this property is set to false, a pool waits no longer than a designated connection wait duration no matter how long it takes to create a new connection to grow a pool, if no connection is available at this moment. If this property is set to true, then in this backward compatibility mode a pool waits for a connection to be synchronously created in a borrow thread, and the waiting time can take longer than connectionWaitDuration. For connectionWaitDuration please refer to
PoolDataSource.setConnectionWaitDuration(java.time.Duration).- Parameters:
createConnectionInBorrowThread- if true, create connections in a borrow thread.
-
isReadOnlyInstanceAllowed
java.lang.Boolean isReadOnlyInstanceAllowed()
Returns true if the connection borrow is allowed to a read-only instance, false otherwise. This property is applicable to sharded database only. A shard instance can be in read-only mode for a chunk if chunk move/split operation is in progress.- Returns:
- true if the connection borrow is allowed to a read-only instance, false otherwise.
-
setReadOnlyInstanceAllowed
void setReadOnlyInstanceAllowed(java.lang.Boolean readOnlyInstanceAllowed)
Sets the read-only instance allowed value on the datasource. This property is applicable to sharded database only. When the property value is set to true, UCP allows connection borrow to read-only instances as well otherwise not. A shard instance goes into read-only mode for a chunk if the chunk move/split operation is in progress on that instance. The default value is false which means by default connection borrow is not allowed to a read-only instance.- Parameters:
readOnlyInstanceAllowed- whether to allow connection borrow to a read-only instance or not
-
getAvailableConnectionsCount
java.lang.Integer getAvailableConnectionsCount()
Gets the available connections count of the Universal Connection Pool instance.- Returns:
- The available connections count.
-
getBorrowedConnectionsCount
java.lang.Integer getBorrowedConnectionsCount()
Gets the borrowed connections count of the Universal Connection Pool instance.- Returns:
- The borrowed connections count.
-
getStatistics
java.lang.String getStatistics()
Gets statistics for the Universal Connection Pool instance.- Returns:
- The statistics.
-
getLifeCycleState
java.lang.String getLifeCycleState()
Gets the lifecycle state of Universal Connection Pool instance.- Returns:
- The lifecycle state.
-
getUCPMBeanAttributes
javax.management.modelmbean.ModelMBeanAttributeInfo[] getUCPMBeanAttributes() throws UniversalConnectionPoolExceptionBuilds the attribute information for the Universal Connection Pool MBean.- Returns:
ModelMBeanAttributeInfo[].- Throws:
UniversalConnectionPoolException- If an error occurs while gettingModelMBeanAttributeInfo[].
-
getUCPMBeanOperations
javax.management.modelmbean.ModelMBeanOperationInfo[] getUCPMBeanOperations() throws UniversalConnectionPoolExceptionBuilds the operation information for the Universal Connection Pool MBean.- Returns:
ModelMBeanOperationInfo[].- Throws:
UniversalConnectionPoolException- If an error occurs while gettingModelMBeanOperationInfo[].
-
getMBeanInfo
javax.management.modelmbean.ModelMBeanInfo getMBeanInfo(javax.management.ObjectName mbeanObjName, java.lang.String mbeanDisplayName) throws UniversalConnectionPoolExceptionBuildsMBeanInfoto define attributes, constructors, operations and notifications to expose to the remote users.- Parameters:
mbeanObjName- Unique name for the Universal Connection Pool MBean.mbeanDisplayName- Display name for the Universal Connection Pool MBean.- Returns:
ModelMBeanInfofor Universal Connection Pool MBean.- Throws:
UniversalConnectionPoolException- If an error occurs while gettingModelMBeanInfofor the Universal Connection Pool MBean.
-
useStrictWebSessionAffinity
void useStrictWebSessionAffinity(java.lang.Boolean strict)
The knob for switching strict web session affinity- Parameters:
strict- if strict, otherwise nonstrict
-
useStrictXAAffinity
void useStrictXAAffinity(java.lang.Boolean strict)
The knob for switching strict XA affinity- Parameters:
strict- true if strict, otherwise non-strict
-
getSecondsToTrustIdleConnection
java.lang.Integer getSecondsToTrustIdleConnection()
Gets the seconds To Trust Idle Connection value. See property description insetSecondsToTrustIdleConnection().- Returns:
- Seconds To Trust Idle Connection value.
-
setSecondsToTrustIdleConnection
void setSecondsToTrustIdleConnection(java.lang.Integer secondsToTrustIdleConnection) throws UniversalConnectionPoolExceptionSets the time in seconds to trust an idle connection to skip a validation test. It works in conjunction withsetValidateConnectionOnBorrow(boolean). When set to any positive value, a connection validation during the checkout is skipped if the connection was successfully used and returned to the pool within the time specified for secondsToTrustIdleConnection. Default value is set to 0 seconds which means that the feature is disabled.With this mode enabled, UCP will do a SOCKET validation on every connection borrow and default driver validation type (can be changed with the "oracle.jdbc.defaultConnectionValidation" system property) after designated seconds to trust idle connection has passed
- Parameters:
secondsToTrustIdleConnection- The value of how long a connection can be trusted to skip connectionValidationOnBorrow- Throws:
UniversalConnectionPoolException- in case of inability to set timeout
-
getTotalConnectionsCount
java.lang.Integer getTotalConnectionsCount()
Gets the total number of connections (both available and borrowed) in the connection pool.- Returns:
- The total number of connections (both available and borrowed) in the connection pool.
-
getAverageBorrowedConnectionsCount
java.lang.Integer getAverageBorrowedConnectionsCount()
Gets the average number of connections that are borrowed and actively in use by clients.- Returns:
- The number of connections that are borrowed and actively in use by clients.
-
getPeakConnectionsCount
java.lang.Integer getPeakConnectionsCount()
Gets the maximum number of connections that the connection pool has reached during the life of the pool.- Returns:
- The maximum number of connections that the connection pool has reached during the life of the pool.
-
getPeakBorrowedConnectionsCount
default java.lang.Integer getPeakBorrowedConnectionsCount()
Gets the maximum number of borrowed connections that the connection pool has reached during the life of the pool.- Returns:
- The maximum number of borrowed connections that the connection pool has reached during the life of the pool.
-
getRemainingPoolCapacityCount
java.lang.Integer getRemainingPoolCapacityCount()
Gets the number of connections that may be added to the pool before it reachesmaxPoolSize.- Returns:
- The number of connections that may be added to the pool before
it reaches
maxPoolSize.
-
getLabeledConnectionsCount
java.lang.Integer getLabeledConnectionsCount()
Gets the number of labeled connections in the connection pool.- Returns:
- The number of labeled connections in the connection pool.
-
getConnectionsCreatedCount
java.lang.Integer getConnectionsCreatedCount()
Gets the number of connections created for this connection pool.- Returns:
- The number of connections created for this connection pool.
-
getConnectionsClosedCount
java.lang.Integer getConnectionsClosedCount()
Gets the number of connections closed by this connection pool.- Returns:
- The number of connections closed by this connection pool.
-
getAverageConnectionWaitTime
java.lang.Long getAverageConnectionWaitTime()
Gets the average time (in milliseconds) a user thread has to wait before it could obtain a connection from the connection pool.- Returns:
- The average time (in milliseconds) a user thread has to wait before it could obtain a connection from the connection pool.
-
getPeakConnectionWaitTime
java.lang.Long getPeakConnectionWaitTime()
Gets the longest wait (in milliseconds) a user request has to incur before obtaining a connection from the connection pool. This includes threads that waited unsuccessfully for a connection.- Returns:
- The longest wait (in milliseconds) a user request has to incur before obtaining a connection from the connection pool.
-
getAbandonedConnectionsCount
java.lang.Integer getAbandonedConnectionsCount()
Gets the number of abandoned connections that have been reclaimed.- Returns:
- The number of abandoned connections that have been reclaimed.
-
getPendingRequestsCount
java.lang.Integer getPendingRequestsCount()
Gets the number of clients that are currently waiting to obtain a connection from the pool.- Returns:
- The number of clients that are currently waiting to obtain a connection from the pool.
-
getCumulativeConnectionWaitTime
java.lang.Long getCumulativeConnectionWaitTime()
Gets the cumulative time (in milliseconds) that connection requests have waited for connections over the life of the connection pool. This includes the time connections waited successfully and obtained a connection from the pool and those that failed waiting for a connection.- Returns:
- The cumulative time (in milliseconds) that connection requests have waited for connections over the life of the connection pool.
-
getCumulativeConnectionBorrowedCount
java.lang.Long getCumulativeConnectionBorrowedCount()
Gets the number of connections borrowed from the connection pool over the life of the pool. This count is incremented each time a connection is borrowed.- Returns:
- The number of connections borrowed from the connection pool over the life of the pool.
-
getCumulativeConnectionUseTime
java.lang.Long getCumulativeConnectionUseTime()
Gets the cumulative time (in milliseconds) of connections that were borrowed from the pool and remained in use.- Returns:
- The cumulative time (in milliseconds) of connections that were borrowed from the pool and remained in use.
-
getCumulativeConnectionReturnedCount
java.lang.Long getCumulativeConnectionReturnedCount()
Gets the number of connections returned to the connection pool over the life of the pool.- Returns:
- The number of connections returned to the connection pool over the life of the pool.
-
getCumulativeSuccessfulConnectionWaitTime
java.lang.Long getCumulativeSuccessfulConnectionWaitTime()
Gets the cumulative time (in milliseconds) that connection requests waited successfully and borrowed a connection from the pool.- Returns:
- The cumulative time (in milliseconds) that connection requests waited successfully and borrowed a connection from the pool.
-
getCumulativeSuccessfulConnectionWaitCount
java.lang.Long getCumulativeSuccessfulConnectionWaitCount()
Gets the number of connection requests that waited successfully and borrowed a connection from the pool.- Returns:
- The number of connection requests that waited successfully and borrowed a connection from the pool.
-
getCumulativeFailedConnectionWaitTime
java.lang.Long getCumulativeFailedConnectionWaitTime()
Gets the cumulative time (in milliseconds) that connection requests waited but failed to borrow a connection from the pool.- Returns:
- The cumulative time (in milliseconds) that connection requests waited but failed to borrow a connection from the pool.
-
getCumulativeFailedConnectionWaitCount
java.lang.Long getCumulativeFailedConnectionWaitCount()
Gets the number of connection requests that waited unsuccessfully to borrow a connection from the pool.- Returns:
- The number of connection requests that waited unsuccessfully to borrow a connection from the pool.
-
getSuccessfulAffinityBasedBorrowCount
java.lang.Long getSuccessfulAffinityBasedBorrowCount()
Gets the number of borrow requests succeeded with matching affinity contexts.- Returns:
- The number of borrow requests succeeded with matching affinity contexts.
-
getFailedAffinityBasedBorrowCount
java.lang.Long getFailedAffinityBasedBorrowCount()
Gets the number of borrow requests that returned connections not matching the affinity contexts.- Returns:
- The number of borrow requests that returned connections not matching the affinity contexts.
-
getSuccessfulRCLBBasedBorrowCount
java.lang.Long getSuccessfulRCLBBasedBorrowCount()
Gets the number of borrow requests succeeded using Runtime Connection Load-Balancing (RCLB) algorithms.- Returns:
- The number of borrow requests succeeded using Runtime Connection Load-Balancing (RCLB) algorithms.
-
getFailedRCLBBasedBorrowCount
java.lang.Long getFailedRCLBBasedBorrowCount()
Gets the number of borrow requests failed using Runtime Connection Load-Balancing (RCLB) algorithms.- Returns:
- The number of borrow requests failed using Runtime Connection Load-Balancing (RCLB) algorithms.
-
getFcfProcessingInfo
java.lang.String getFcfProcessingInfo()
Gets the information of recent Fast Connection Failover (FCF) attempts, in the form of a String. The information returned is to help diagnosing FCF problems, and includes the outcome of each FCF attempt (successful or failed), the relevant RAC instances, the number of connections cleaned up, the exception that triggered the FCF attempt failure, etc.- Returns:
- The information string for recent FCF attempts.
-
getFcfProcessingInfoProcessedOnly
java.lang.String getFcfProcessingInfoProcessedOnly()
-
getConnectionRepurposeCount
java.lang.Long getConnectionRepurposeCount()
Returns the number of connection repurposed in a shared pool for a mutitenant database, where connections can be reused across PDB's by switching their container and PDB service.- Returns:
- repurpose count
-
getShardConnectionStats
java.lang.String getShardConnectionStats()
Returns total, borrowed and available connection counts to various shards discovered by the pool so far. These numbers are not cumulative, and only reflect the current connection counts at the time of this method call.
-
getColocationStats
java.lang.String getColocationStats()
Get processing info for COLOCATION_TAG support. This currently contains only information on whether all the non-applicable HA features are disabled.- Returns:
- String with processing info for COLOCATION_TAG support.
-
getTraceEnabled
java.lang.Boolean getTraceEnabled()
- Returns:
- true, if trace is enabled.
-
setTraceEnabled
void setTraceEnabled(java.lang.Boolean enabled)
Enable or disable tracing. Tracing is the logging into a memory buffer and pushing that buffer in some special cases (some threshold logging level or errors of specified numbers)- Parameters:
enabled- true to enable tracing, false otherwise.
-
getLoggingEnabled
java.lang.Boolean getLoggingEnabled()
- Returns:
- true, if logging is enabled.
-
setLoggingEnabled
void setLoggingEnabled(java.lang.Boolean enabled)
Enable or disable logging.- Parameters:
enabled- true to enable logging, false otherwise.
-
getLogLevel
java.util.logging.Level getLogLevel()
Get a current logging level.- Returns:
- current logging level.
-
getLogLevelStr
java.lang.String getLogLevelStr()
-
setLogLevel
void setLogLevel(java.util.logging.Level logLevel)
Set a current logging level.- Parameters:
logLevel- current logging level to set.
-
setLogLevelStr
void setLogLevelStr(java.lang.String logLevel)
-
getBufferSize
java.lang.Integer getBufferSize()
Get in-memory trace buffer size.- Returns:
- current in-memory trace buffer size.
-
setBufferSize
void setBufferSize(java.lang.Integer bufferSize)
Set in-memory trace buffer size.- Parameters:
bufferSize- current in-memory trace buffer size to set.
-
-