Package com.complexible.stardog.api

# Class ConnectionPoolConfig

java.lang.Object
com.complexible.common.pool.PoolConfig<Connection,StardogException>
com.complexible.stardog.api.ConnectionPoolConfig

public final class ConnectionPoolConfig extends PoolConfig<Connection,StardogException>

A configuration object for creating connection pools.

Since:
  0.5.1
Version:
  2.0
Author:
  Michael Grove

- ## Field Summary

  ### Fields inherited from class com.complexible.common.pool.PoolConfig

  `mConfig, mMinPool`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ConnectionPoolConfig`
  `blockAtCapacity(long theTime, TimeUnit theUnit)`
  Set the amount of time to wait to obtain an object.
  `ConnectionPool`
  `create()`
  Create the Pool
  `ConnectionPoolConfig`
  `expiration(long theTime, TimeUnit theUnit)`
  Specifes the minimum amount of time something should remain idle for before it is eligible to be expired.
  `ConnectionPoolConfig`
  `failAtCapacity()`
  Configure the pool to fail to obtain an object if you are at `PoolConfig.maxPool(int)` objects.
  `ConnectionPoolConfig`
  `growAtCapacity()`
  Configure the pool to grow if it is at `PoolConfig.maxPool(int)` objects, effectively rendering the max moot.
  `ConnectionPoolConfig`
  `maxIdle(int theMaxIdle)`
  The maximum number of objects which are allowed to sit idle in the pool.
  `ConnectionPoolConfig`
  `maxPool(int theMax)`
  Set the maximum number of objects that can be active in the pool (leased or idle).
  `ConnectionPoolConfig`
  `minPool(int theMin)`
  Set the minimum size of the pool, ie, the number of objects to start with.
  `ConnectionPoolConfig`
  `noExpiration()`
  Set that entries should not timeout/expire while idle
  `static ConnectionPoolConfig`
  `using(ConnectionConfiguration theConfig)`
  Create a new ConnectionPoolConfig for the provided ConnectionConfiguration.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### using

    public static ConnectionPoolConfig using(ConnectionConfiguration theConfig)
    Create a new ConnectionPoolConfig for the provided ConnectionConfiguration. All objects in the ConnectionPool will be instantiated by the provided config.
    Parameters:
      `theConfig` - the configuration
    Returns:
      a new ConnectionPoolConfig

  - ### maxIdle

    public ConnectionPoolConfig maxIdle(int theMaxIdle)
    The maximum number of objects which are allowed to sit idle in the pool. The default is -1, which means there is no limit of idle objects.
    Overrides:
      `maxIdle` in class `PoolConfig<Connection,StardogException>`
    Parameters:
      `theMaxIdle` - the max idle
    Returns:
      this object

  - ### maxPool

    public ConnectionPoolConfig maxPool(int theMax)
    Set the maximum number of objects that can be active in the pool (leased or idle). The default is 1000
    Overrides:
      `maxPool` in class `PoolConfig<Connection,StardogException>`
    Parameters:
      `theMax` - the max
    Returns:
      this object

  - ### minPool

    public ConnectionPoolConfig minPool(int theMin)
    Set the minimum size of the pool, ie, the number of objects to start with. Default is 0.
    Overrides:
      `minPool` in class `PoolConfig<Connection,StardogException>`
    Parameters:
      `theMin` - the min pool size
    Returns:
      this object

  - ### growAtCapacity

    public ConnectionPoolConfig growAtCapacity()
    Configure the pool to grow if it is at `PoolConfig.maxPool(int)` objects, effectively rendering the max moot.
    Overrides:
      `growAtCapacity` in class `PoolConfig<Connection,StardogException>`
    Returns:
      this object

  - ### failAtCapacity

    public ConnectionPoolConfig failAtCapacity()
    Configure the pool to fail to obtain an object if you are at `PoolConfig.maxPool(int)` objects.
    Overrides:
      `failAtCapacity` in class `PoolConfig<Connection,StardogException>`
    Returns:
      this object

  - ### blockAtCapacity

    public ConnectionPoolConfig blockAtCapacity(long theTime, TimeUnit theUnit)
    Set the amount of time to wait to obtain an object. This will have `Pool.obtain()` block the specified amount of time until an object can be obtained. If the max is reached, obtain will return null. The default is that it will block indefinitely (-1 value for theTime).
    Overrides:
      `blockAtCapacity` in class `PoolConfig<Connection,StardogException>`
    Parameters:
      `theTime` - the time to wait
      `theUnit` - the unit of time
    Returns:
      this object

  - ### noExpiration

    public ConnectionPoolConfig noExpiration()
    Set that entries should not timeout/expire while idle
    Overrides:
      `noExpiration` in class `PoolConfig<Connection,StardogException>`
    Returns:
      this object

  - ### expiration

    public ConnectionPoolConfig expiration(long theTime, TimeUnit theUnit)
    Specifes the minimum amount of time something should remain idle for before it is eligible to be expired. The default is 30 minutes
    Overrides:
      `expiration` in class `PoolConfig<Connection,StardogException>`
    Parameters:
      `theTime` - the amount of time
      `theUnit` - the unit of time
    Returns:
      this configuration

  - ### create

    public ConnectionPool create()
    Create the Pool
    Specified by:
      `create` in class `PoolConfig<Connection,StardogException>`
    Returns:
      the pool