Package io.vertx.core.http

## Class PoolOptions

- java.lang.Object
- - io.vertx.core.http.PoolOptions

-     public class PoolOptions
      extends Object

  Options configuring a `HttpClient` pool.
  Author:
    Julien Viet

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_HTTP2_MAX_POOL_SIZE` | The default maximum number of connections an HTTP/2 client will pool = 1
    `static int` | `DEFAULT_MAX_POOL_SIZE` | The default maximum number of HTTP/1 connections a client will pool = 5
    `static int` | `DEFAULT_MAX_WAIT_QUEUE_SIZE` | Default max wait queue size = -1 (unbounded)
    `static int` | `DEFAULT_MAXIMUM_LIFETIME` | Default maximum pooled connection lifetime = 0 (no maximum)
    `static TimeUnit` | `DEFAULT_MAXIMUM_LIFETIME_TIME_UNIT` | Default maximum pooled connection lifetime unit = seconds
    `static int` | `DEFAULT_POOL_CLEANER_PERIOD` | Default pool cleaner period = 1000 ms (1 second)
    `static int` | `DEFAULT_POOL_EVENT_LOOP_SIZE` | Default pool event loop size = 0 (reuse current event-loop)

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PoolOptions()` | Default constructor
    `PoolOptions​(PoolOptions other)` | Copy constructor
    `PoolOptions​(JsonObject json)` | Constructor to create an options from JSON

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getCleanerPeriod()` |
    `int` | `getEventLoopSize()` |
    `int` | `getHttp1MaxSize()` | Get the maximum pool size for HTTP/1.x connections
    `int` | `getHttp2MaxSize()` | Get the maximum pool size for HTTP/2 connections
    `int` | `getMaxLifetime()` |
    `TimeUnit` | `getMaxLifetimeUnit()` |
    `int` | `getMaxWaitQueueSize()` | Returns the maximum wait queue size
    `PoolOptions` | `setCleanerPeriod​(int cleanerPeriod)` | Set the connection pool cleaner period in milli seconds, a non positive value disables expiration checks and connections will remain in the pool until they are closed.
    `PoolOptions` | `setEventLoopSize​(int eventLoopSize)` | Set the number of event-loop the pool use.
    `PoolOptions` | `setHttp1MaxSize​(int http1MaxSize)` | Set the maximum pool size for HTTP/1.x connections
    `PoolOptions` | `setHttp2MaxSize​(int max)` | Set the maximum pool size for HTTP/2 connections
    `PoolOptions` | `setMaxLifetime​(int maxLifetime)` | Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.
    `PoolOptions` | `setMaxLifetimeUnit​(TimeUnit maxLifetimeUnit)` | Establish a max lifetime unit for pooled connections.
    `PoolOptions` | `setMaxWaitQueueSize​(int maxWaitQueueSize)` | Set the maximum requests allowed in the wait queue, any requests beyond the max size will result in a ConnectionPoolTooBusyException.
    `JsonObject` | `toJson()` |

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

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

- - ### Field Detail

    - #### DEFAULT_MAX_POOL_SIZE

          public static final int DEFAULT_MAX_POOL_SIZE

      The default maximum number of HTTP/1 connections a client will pool = 5
      See Also:
        Constant Field Values

    - #### DEFAULT_HTTP2_MAX_POOL_SIZE

          public static final int DEFAULT_HTTP2_MAX_POOL_SIZE

      The default maximum number of connections an HTTP/2 client will pool = 1
      See Also:
        Constant Field Values

    - #### DEFAULT_MAX_WAIT_QUEUE_SIZE

          public static final int DEFAULT_MAX_WAIT_QUEUE_SIZE

      Default max wait queue size = -1 (unbounded)
      See Also:
        Constant Field Values

    - #### DEFAULT_MAXIMUM_LIFETIME

          public static final int DEFAULT_MAXIMUM_LIFETIME

      Default maximum pooled connection lifetime = 0 (no maximum)
      See Also:
        Constant Field Values

    - #### DEFAULT_MAXIMUM_LIFETIME_TIME_UNIT

          public static final TimeUnit DEFAULT_MAXIMUM_LIFETIME_TIME_UNIT

      Default maximum pooled connection lifetime unit = seconds

    - #### DEFAULT_POOL_CLEANER_PERIOD

          public static final int DEFAULT_POOL_CLEANER_PERIOD

      Default pool cleaner period = 1000 ms (1 second)
      See Also:
        Constant Field Values

    - #### DEFAULT_POOL_EVENT_LOOP_SIZE

          public static final int DEFAULT_POOL_EVENT_LOOP_SIZE

      Default pool event loop size = 0 (reuse current event-loop)
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PoolOptions

          public PoolOptions()

      Default constructor

    - #### PoolOptions

          public PoolOptions​(PoolOptions other)

      Copy constructor
      Parameters:
        `other` - the options to copy

    - #### PoolOptions

          public PoolOptions​(JsonObject json)

      Constructor to create an options from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### getHttp1MaxSize

          public int getHttp1MaxSize()

      Get the maximum pool size for HTTP/1.x connections
      Returns:
        the maximum pool size

    - #### setHttp1MaxSize

          public PoolOptions setHttp1MaxSize​(int http1MaxSize)

      Set the maximum pool size for HTTP/1.x connections
      Parameters:
        `http1MaxSize` - the maximum pool size
      Returns:
        a reference to this, so the API can be used fluently

    - #### getHttp2MaxSize

          public int getHttp2MaxSize()

      Get the maximum pool size for HTTP/2 connections
      Returns:
        the maximum pool size

    - #### setHttp2MaxSize

          public PoolOptions setHttp2MaxSize​(int max)

      Set the maximum pool size for HTTP/2 connections
      Parameters:
        `max` - the maximum pool size
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxLifetimeUnit

          public TimeUnit getMaxLifetimeUnit()

      Returns:
        the pooled connection max lifetime unit

    - #### setMaxLifetimeUnit

          public PoolOptions setMaxLifetimeUnit​(TimeUnit maxLifetimeUnit)

      Establish a max lifetime unit for pooled connections.
      Parameters:
        `maxLifetimeUnit` - pooled connection max lifetime unit
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxLifetime

          public int getMaxLifetime()

      Returns:
        pooled connection max lifetime

    - #### setMaxLifetime

          public PoolOptions setMaxLifetime​(int maxLifetime)

      Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.
      Parameters:
        `maxLifetime` - the pool connection max lifetime
      Returns:
        a reference to this, so the API can be used fluently

    - #### getCleanerPeriod

          public int getCleanerPeriod()

      Returns:
        the connection pool cleaner period in ms.

    - #### setCleanerPeriod

          public PoolOptions setCleanerPeriod​(int cleanerPeriod)

      Set the connection pool cleaner period in milli seconds, a non positive value disables expiration checks and connections will remain in the pool until they are closed.
      Parameters:
        `cleanerPeriod` - the pool cleaner period
      Returns:
        a reference to this, so the API can be used fluently

    - #### getEventLoopSize

          public int getEventLoopSize()

      Returns:
        the max number of event-loop a pool will use, the default value is `0` which implies to reuse the current event-loop

    - #### setEventLoopSize

          public PoolOptions setEventLoopSize​(int eventLoopSize)

      Set the number of event-loop the pool use.
      - when the size is `0`, the client pool will use the current event-loop
      - otherwise the client will create and use its own event loop
      The default size is `0`.
      Parameters:
        `eventLoopSize` - the new size
      Returns:
        a reference to this, so the API can be used fluently

    - #### setMaxWaitQueueSize

          public PoolOptions setMaxWaitQueueSize​(int maxWaitQueueSize)

      Set the maximum requests allowed in the wait queue, any requests beyond the max size will result in a ConnectionPoolTooBusyException. If the value is set to a negative number then the queue will be unbounded.
      Parameters:
        `maxWaitQueueSize` - the maximum number of waiting requests
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxWaitQueueSize

          public int getMaxWaitQueueSize()

      Returns the maximum wait queue size
      Returns:
        the maximum wait queue size

    - #### toJson

          public JsonObject toJson()