Package oracle.ucp

Interface UniversalConnectionPool

All Superinterfaces:
Diagnosable

public interface UniversalConnectionPool extends Diagnosable
A connection pool that pools any type of connection (called a physical connection).

There are several key objects that make up the connection pool:

  • The physical pool itself
  • The connection factory adapter
  • The pooled connection
  • The connection retrieval info object

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).

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, and so forth). 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.

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.

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.

Pool Properties The pool provides some properties for users to customize the pool's behavior, such as:

  • minPoolSize The minimum number of connections that the pool maintains.
  • maxPoolSize The maximum number of connections that the pool maintains.
  • initialPoolSize The initial number of connections in the pool.

Statistics The pool maintains some statistics such as:

  • The number of connections that are in use (borrowed) at any given time.
  • The number of connections that are available (not in use) at any given time.
  • The number of physical connections created by the resource.
  • The number of physical connections closed by the resource.

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).

See Also:
  • Method Details

    • borrowConnection

      Gets a connection from the connection pool.
      Parameters:
      connectionRetrievalInfo - Info to use to get the connection.
      Returns:
      A UniversalPooledConnection for the specified connection retrieval info.
      Throws:
      UniversalConnectionPoolException - if an error occurs getting a connection.
      NoAvailableConnectionsException - if all of the connections are in use.
    • borrowConnectionAsync

      Get a connection from a pool asynchronously
      Parameters:
      cri - Info to use to get the connection.
      executor - executor for asychronous processing
      Returns:
      completion stage of a connection borrow operation
      Throws:
      UnsupportedOperationException
    • returnConnection

      void returnConnection(UniversalPooledConnection pooledConnection) throws UniversalConnectionPoolException
      Returns a connection back into the connection pool. The pool can decide to close the underlying physical connection when necessary.
      Parameters:
      pooledConnection - The connection to return back into the pool.
      Throws:
      UniversalConnectionPoolException - in case it is not possible to return connection.
    • closeConnection

      void closeConnection(UniversalPooledConnection pooledConnection) throws UniversalConnectionPoolException
      Closes the pooled connection. Do not put it back into the pool.
      Parameters:
      pooledConnection - The pooled connection to close.
      Throws:
      UniversalConnectionPoolException - if an error occurs closing the connection.
    • refresh

      void refresh() throws UniversalConnectionPoolException
      Allows connections in the pool, both borrowed and available ones, to be replaced with new/fresh connections. All of the available connections are removed before replacing them with new connections. However, a borrowed connection is marked for removal. When such a borrowed connection is returned to the pool, it is closed and replaced with a new connection with the same user credentials.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to refresh.
    • recycle

      void recycle() throws UniversalConnectionPoolException
      Allows only invalid available connections in the pool to be replaced with new/fresh connections.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to recycle.
    • purge

      Removes all connections from the connection pool. The primary difference in behavior between this and 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.

      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.

      Throws:
      UniversalConnectionPoolException - in case it was not possible to purge.
    • reconfigure

      void reconfigure(Properties props) throws UniversalConnectionPoolException
      Allows a connection pool to be reconfigured gracefully with a different set of properties that specify the behavior of the connection pool at runtime. Reconfiguration of connection pool properties is always non-disruptive. If this operation cannot be completed right away, then the call returns and the enforcement of the properties continue to occur asynchronously.
      Parameters:
      props - Containing new set of pool properties for reconfiguration.
      Throws:
      UniversalConnectionPoolException - in case it wat not possible to reconfigure.
    • start

      void start(ConnectionRetrievalInfo connectionRetrievalInfo, boolean keepMetadataConn) throws UniversalConnectionPoolException
      Starts the connection pool.
      Parameters:
      connectionRetrievalInfo - retrieval info with data for creation metadata connection.
      keepMetadataConn - keep metadata connection in the working set even if init pool size is 0 (because the next operation will be "borrow").
      Throws:
      UniversalConnectionPoolException - If an error occurs during start.
    • start

      default void start() throws UniversalConnectionPoolException
      if keepMetadataConn is not specified, assume it is "false".
      Throws:
      UniversalConnectionPoolException
    • stop

      Stops the connection pool.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to stop.
    • getName

      String getName()
      Gets the name of the connection pool.
      Returns:
      The name of the connection pool.
    • setName

      void setName(String name)
      Sets the name of the connection pool.
      Parameters:
      name - The name of the connection pool.
    • getInitialPoolSize

      int getInitialPoolSize()
      Gets the initial pool size.
      Returns:
      the initial pool size.
    • setInitialPoolSize

      void setInitialPoolSize(int initialPoolSize) throws UniversalConnectionPoolException
      Sets the initial pool size. This is the number of connections that are created and placed in the pool upon initialization.
      Parameters:
      initialPoolSize - the initial pool size.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set initial pool size.
    • getMinPoolSize

      int getMinPoolSize()
      Gets the minimum number of connections that the connection pool maintains.
      Returns:
      The minimum number of connections.
    • setMinPoolSize

      void setMinPoolSize(int minPoolSize) throws UniversalConnectionPoolException
      Sets the minimum number of connections. If the number of available connections PLUS the number of connections in use IS LESS THAN the minimum, then the connection is returned to the pool. Otherwise, the connection is closed. The default is 1 connection.
      Parameters:
      minPoolSize - The minimum number of connections.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set min pool size.
    • getMinIdle

      int getMinIdle()
      Gets the minimum number of idle connections that the connection pool maintains.
      Returns:
      The minimum number of idle connections.
    • setMinIdle

      void setMinIdle(int minIdle) throws UniversalConnectionPoolException
      Sets the minimum number of idle connections. If the number of available connections IS LESS THAN the minimum, then new connections are created and made available in pool. The default is 0.
      Parameters:
      minIdle - The minimum number of idle connections.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set min idle.
    • getMaxPoolSize

      int getMaxPoolSize()
      Gets the maximum number of connections that the connection pool maintains.
      Returns:
      The maximum number of connections.
    • setMaxPoolSize

      void setMaxPoolSize(int maxPoolSize) throws UniversalConnectionPoolException
      Sets the maximum number of connections. The maximum number of connections includes the number of connections that are in use as well as the number of available connections. The default value is Integer.MAX_VALUE.
      Parameters:
      maxPoolSize - The maximum number of connections.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set max pool size.
    • getInactiveConnectionTimeout

      int getInactiveConnectionTimeout()
      Gets the inactive connection timeout value.
      Returns:
      The inactive connection timeout.
    • setInactiveConnectionTimeout

      void setInactiveConnectionTimeout(int inactiveConnectionTimeout) throws UniversalConnectionPoolException
      Sets the inactive connection timeout. This timeout determines how long an available connection remains in the connection pool before it is removed from the pool.

      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 - The inactive connection timeout (in seconds).
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getAbandonedConnectionTimeout

      int getAbandonedConnectionTimeout()
      Gets the abandoned connection timeout value.
      Returns:
      The abandoned connection timeout.
    • setAbandonedConnectionTimeout

      void setAbandonedConnectionTimeout(int abandonedConnectionTimeout) throws UniversalConnectionPoolException
      Sets the abandoned connection timeout. This timeout determines how long a borrowed connection can remain unused before it is considered abandoned and reclaimed by the connection pool.
      Parameters:
      abandonedConnectionTimeout - The value of how long a connection has not been used before it is abandoned (in seconds).
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getConnectionWaitTimeout

      @Deprecated int getConnectionWaitTimeout()
      Deprecated.
      Gets the maximum time (in seconds) that any connection borrow request can wait before it returns to the application.

      This method is deprecated. Use getConnectionWaitDuration() instead.

      Returns:
      The connection wait timeout.
      See Also:
    • getConnectionWaitDuration

      Duration getConnectionWaitDuration()

      Gets the maximum time (in java.time.Duration) that any connection borrow request can wait before it returns to the application.

      Returns:
      The connection wait duration.
      See Also:
    • setConnectionWaitTimeout

      @Deprecated void setConnectionWaitTimeout(int waitTimeout) throws UniversalConnectionPoolException
      Deprecated.

      Configures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.

      The wait timeou 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 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.

      This method is deprecated. Use setConnectionWaitDuration(java.time.Duration) instead.

      Parameters:
      waitTimeout - The amount of time for a connection request to wait.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • setConnectionWaitDuration

      void setConnectionWaitDuration(Duration waitDuration) throws UniversalConnectionPoolException

      Configures 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.ZERO 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.

      Parameters:
      waitDuration - The duration for a connection request to wait.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getTimeToLiveConnectionTimeout

      int getTimeToLiveConnectionTimeout()
      Gets the maximum time (in seconds) a connection may remain in-use. The used connection is unconditionally returned to the connection pool when this timeout expires. A value of 0 means that the feature is not enabled.
      Returns:
      The maximum time (in seconds) a used connection may be active.
    • setTimeToLiveConnectionTimeout

      void setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) throws UniversalConnectionPoolException
      Sets the maximum time (in seconds) a connection may remain in-use.
      Parameters:
      timeToLiveConnectionTimeout - The maximum time (in seconds) a used connection may be active.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getTimeoutCheckInterval

      int getTimeoutCheckInterval()
      Gets the frequency (in seconds) to enforce the timeout properties. It applies to all of the connection pool timeouts including abandonedConnectionTimeout, inactiveConnectionTimeout, and timeToLiveConnectionTimeout.
      Returns:
      The frequency (in seconds) to enforce the timeout properties.
    • setTimeoutCheckInterval

      void setTimeoutCheckInterval(int timeoutCheckInterval) throws UniversalConnectionPoolException
      Sets the frequency (in seconds) to enforce the timeout properties.
      Parameters:
      timeoutCheckInterval - The frequency (in seconds) to enforce the timeout properties.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getValidateConnectionOnBorrow

      boolean getValidateConnectionOnBorrow()
      Returns whether or not a connection being borrowed should first be validated. When this property is set to true, connection validity is performed before returning the connection to the user.
      Returns:
      Whether or not a connection being borrowed should first be validated.
    • setValidateConnectionOnBorrow

      void setValidateConnectionOnBorrow(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 - Whether or not a connection being borrowed should first be validated.
      See Also:
    • getConnectionHarvestTriggerCount

      int getConnectionHarvestTriggerCount()
      Gets the number of available connections below which the connection pool's connection harvesting occurs. For example, if the value is set to 10, then connection harvesting occurs when the number of available connections drops to 10.
      Returns:
      The number of available connections below which the connection pool's connection harvesting occurs.
    • setConnectionHarvestTriggerCount

      void setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount) throws UniversalConnectionPoolException
      Sets the number of available connections below which the connection pool's connection harvesting occurs.
      Parameters:
      connectionHarvestTriggerCount - The number of available connections below which the connection pool's connection harvesting occurs.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set count.
    • getConnectionHarvestMaxCount

      int getConnectionHarvestMaxCount()
      Gets the maximum number of connections that may be harvested when the connection harvesting occurs. Note that it is possible that the number of connections that are harvested may be anywhere from 0 to the connectionHarvestMaxCount.
      Returns:
      The maximum number of connections that may be harvested when the connection harvesting occurs.
    • setConnectionHarvestMaxCount

      void setConnectionHarvestMaxCount(int connectionHarvestMaxCount) throws UniversalConnectionPoolException
      Sets the maximum number of connections that may be harvested when the connection harvesting occurs.
      Parameters:
      connectionHarvestMaxCount - the maximum number of connections that may be harvested when the connection harvesting occurs.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getAvailableConnectionsCount

      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).
      Returns:
      The number of connections that are available in the connection pool.
    • getBorrowedConnectionsCount

      int getBorrowedConnectionsCount()
      Gets the number of connections that are actively in use by clients.
      Returns:
      The number of connections that are actively in use by clients.
    • getStatistics

      Gets the statistics of the connection pool.
      Returns:
      The statistics of the connection pool.
    • getLifeCycleState

      Gets the life cycle state of the connection pool.
      Returns:
      The life cycle state of the connection pool.
    • getConnectionRetrievalInfo

      ConnectionRetrievalInfo getConnectionRetrievalInfo()
      Gets the ConnectionRetrievalInfo object which contains user and password information to create the connections.
      Returns:
      ConnectionRetrievalInfo object which contains user and password information to create the connections.
    • setConnectionRetrievalInfo

      void setConnectionRetrievalInfo(ConnectionRetrievalInfo cri)
      Sets the ConnectionRetrievalInfo for creating the initial connections (physical connections) in the pool based on the initialPoolSize property.
      Parameters:
      cri - The ConnectionRetrievalInfo with user and password for creating the initial connections in the pool.
    • registerConnectionAffinityCallback

      void registerConnectionAffinityCallback(ConnectionAffinityCallback cbk) throws UniversalConnectionPoolException
      Registers a ConnectionAffinityCallback objet on the connection pool.
      Parameters:
      cbk - The affinity callback object to be registered
      Throws:
      UniversalConnectionPoolException - If callback registration fails.
    • removeConnectionAffinityCallback

      void removeConnectionAffinityCallback() throws UniversalConnectionPoolException
      Removes the ConnectionAffinityCallback object registered on the connection pool.
      Throws:
      UniversalConnectionPoolException - If callback removal fails.
    • registerConnectionLabelingCallback

      void registerConnectionLabelingCallback(ConnectionLabelingCallback cbk) throws UniversalConnectionPoolException
      Registers a ConnectionLabelingCallback object with this connection pool.
      Parameters:
      cbk - The ConnectionLabelingCallback object to be registered.
      Throws:
      UniversalConnectionPoolException - If there is a callback already registered with this pool.
    • removeConnectionLabelingCallback

      void removeConnectionLabelingCallback() throws UniversalConnectionPoolException
      Removes the ConnectionLabelingCallback object registered with this connection pool, if any.
      Throws:
      UniversalConnectionPoolException - If callback removal fails.
    • getMaxConnectionReuseTime

      long getMaxConnectionReuseTime()
      Gets the maximum connection reuse time property value. See property description in setMaxConnectionReuseTime().
      Returns:
      Maximum connection reuse time (in seconds)
    • setMaxConnectionReuseTime

      void setMaxConnectionReuseTime(long maxConnectionReuseTime) throws UniversalConnectionPoolException
      Sets the maximum connection reuse time property. This property specifies the maximum time any connection can potentially be reused after which the pool removes and closes a connection. The value is specified in seconds and must be greater than 0. For example, if the specified value is 3600 seconds, then when a connection is in existence for more than 3600 seconds, the connection is closed and removed from the pool. Connections are closed gracefully after they are returned to the pool and the specified property value has been exceeded. Default is 0, which means this feature is not enabled.

      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 - Maximum connection reuse time (in seconds).
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set timeout.
    • getMaxConnectionReuseCount

      int getMaxConnectionReuseCount()
      Gets the maximum connection reuse count property value. See property description in setMaxConnectionReuseCount().
      Returns:
      Maximum connection reuse count.
    • setMaxConnectionReuseCount

      void setMaxConnectionReuseCount(int maxConnectionReuseCount) throws UniversalConnectionPoolException
      Sets the maximum connection reuse count property. This property specifies the maximum number of times any connection can be reused after which the pool removes and closes a connection. The value must be greater than 0 for this feature to be enabled. For example, if the specified value is 100, then when a connection is reused or borrowed 100 times from the pool, it is closed and removed from the pool. Connections are closed gracefully after they are returned to the pool and the property value has been exceeded. Default is 0, which means this feature is not enabled.
      Parameters:
      maxConnectionReuseCount - Maximum connection reuse count.
      Throws:
      UniversalConnectionPoolException - in case it was not possible to set count.
    • getSecondsToTrustIdleConnection

      int getSecondsToTrustIdleConnection()
      Gets the seconds To Trust Idle Connection value which determines whether or not connection validation on borrow should be skipped See property description in setSecondsToTrustIdleConnection().
      Returns:
      Seconds To Trust Idle Connection value.
    • setSecondsToTrustIdleConnection

      void setSecondsToTrustIdleConnection(int secondsToTrustIdleConnection) throws UniversalConnectionPoolException
      Sets the time in seconds to trust an idle connection to skip a validation test. It works in conjunction with setValidateConnectionOnBorrow(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 setter was failed.
    • getConnectionLabelingHighCost

      int getConnectionLabelingHighCost()
      Obtains the cost value which identifies a connection as "high-cost" for connection labeling.
      Returns:
      The cost value that identifies a connection as "high-cost" for connection labeling.
      See Also:
    • setConnectionLabelingHighCost

      void setConnectionLabelingHighCost(int highCost) throws UniversalConnectionPoolException
      Sets the cost value which identifies a connection as "high-cost" for connection labeling. Connection labeling uses the cost(Properties, Properties) method in ConnectionLabelingCallback to find a connection in the pool for a request. When this property is set, connections with a cost value equal to or greater than the property value are considered "high-cost" connections. The default value is Integer.MAX_VALUE.
      Parameters:
      highCost - The cost value that identifies a connection as "high-cost" for connection labeling.
      Throws:
      UniversalConnectionPoolException - If an exception occurs while setting the cost.
    • getHighCostConnectionReuseThreshold

      int getHighCostConnectionReuseThreshold()
      Obtains the high-cost connection reuse threshold property value for connection labeling.
      Returns:
      The high-cost connection reuse threshold property value currently set.
      See Also:
    • setHighCostConnectionReuseThreshold

      void setHighCostConnectionReuseThreshold(int threshold) throws UniversalConnectionPoolException
      Sets the high-cost connection reuse threshold for connection labeling. This property works together with the ConnectionLabelingHighCost property to determine when high-cost connections are reused for connection labeling. This property specifies a threshold of the number of total connections in the pool. If Connection Labeling finds all available connections are high-cost connections (i.e., the lowest cost value exceeds the ConnectionLabelingHighCost value), it checks this threshold to determine whether to reuse those connections. Only when this threshold is reached, Connection Labeling will try to reuse the high-cost connections in the pool to serve a labeled connection request. Otherwise, Connection Labeling picks a low-cost connection, a no-label connection available in the pool, or creates a brand-new physical connection to serve a labeled request. For example, if the property value is set to 10, Connection Labeling reuses high-cost connections when there are no low-cost connections available and the total connections reach 10. Note that any labeled connection with cost Integer.MAX_VALUE will not be reused. This is consistent with connection labeling behavior when this property and ConnectionLabelingHighCost are not set. A Connection Labeling callback must be registered at the same time for this property to take effect. The default value is 0, which is treated the same way as MinPoolSize.
      Parameters:
      threshold - The high-cost connection reuse threshold to set.
      Throws:
      UniversalConnectionPoolException - If any exception occurs while setting the threshold.
    • getMaxConnectionsPerService

      int getMaxConnectionsPerService()
      Gets the maximum number of connections that can be obtained to a particular service, in a shared pool.
      Returns:
      The maximum number of connections that can be obtained to a particular service.
    • setMaxConnectionsPerService

      void setMaxConnectionsPerService(int maxConnectionsPerService) throws UniversalConnectionPoolException
      Sets the maximum number of connections that can be obtained to a particular service, in a shared pool. An exception is thrown when setting a different maxConnectionsPerService value on a running pool instance.
      Parameters:
      maxConnectionsPerService - The maximum number of connections that can be obtained to a particular service.
      Throws:
      UniversalConnectionPoolException - If any exception occurs while setting the maxConnectionsPerService value.
    • getConnectionRepurposeThreshold

      int getConnectionRepurposeThreshold()
      Gets the connection repurpose threshold for the pool. This property is used in cases when the connection pool is shared by multiple datasources connecting to the same database but using different services.Only when this threshold is reached the pool will try to repurpose connections between different services before trying to create new connections. This property is applicable only for multi-tenant databases.
      Returns:
      connection repurpose threshold property value currently set.
    • setConnectionRepurposeThreshold

      void setConnectionRepurposeThreshold(Integer threshold) throws UniversalConnectionPoolException
      Sets the connection repurpose threshold for the pool. This property is applicable only for multi-tenant databases.
      Parameters:
      threshold - connection repurpose threshold to set.
      Throws:
      UniversalConnectionPoolException - If any exception occurs while setting the threshold.
      See Also:
    • getLoginTimeout

      int getLoginTimeout()
      Gets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.
      Returns:
      timeout in seconds
    • setLoginTimeout

      void setLoginTimeout(int seconds) throws UniversalConnectionPoolException
      Sets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.
      Parameters:
      seconds - timeout
      Throws:
      UniversalConnectionPoolException - in case of negative value
    • isShareable

      boolean isShareable()
      Returns whether the pool is shareable or not.
      Returns:
      Whether or not pool is shareable.
    • setShardingMode

      void setShardingMode(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

      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(int connectionValidationTimeout) throws UniversalConnectionPoolException
      Connection validation timeout setter This property changes the allowed time for a connection valiadation. If a connection validation operation lasts longer than this timeout, it is interrupted and a connection is considered to be invalid.
      Parameters:
      connectionValidationTimeout - validation timeout in seconds
      Throws:
      UniversalConnectionPoolException - gets thrown in case of negation timeout submitted
    • getConnectionValidationTimeout

      int getConnectionValidationTimeout()
      Connection validation timeout getter This property changes the allowed time for a connection valiadation. If a connection validation operation lasts longer than this timeout, it is interrupted and a connection is considered to be invalid.
      Returns:
      connection validation timeout in seconds
    • isReadOnlyInstanceAllowed

      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(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
    • isCommitOnConnectionReturn

      boolean isCommitOnConnectionReturn()
      Returns the boolean value for the property that controls the behavior of UCP when a connection is released back to the pool with pending uncommitted changes in an active transaction. By default, UCP will commit the changes (default value is "true"). When setting this property to "false" the changes will be rolled back.
      Returns:
      true to commit, false to rollback.
    • setCommitOnConnectionReturn

      void setCommitOnConnectionReturn(boolean commit)
      Sets the boolean value for the property that controls the behavior of UCP when a connection is released back to the pool with pending uncommitted changes in an active transaction. By default, UCP will commit the changes (default value is "true"). When setting this property to "false" the changes will be rolled back.
      Parameters:
      commit - 'true' to commit, 'false' to rollback. The default is 'true'.