Class PoolOptions

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

public class PoolOptions extends Object
Options configuring a HttpClient pool.
Author:
Julien Viet
  • Field Details

    • 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:
    • 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:
    • DEFAULT_HTTP3_MAX_POOL_SIZE

      public static final int DEFAULT_HTTP3_MAX_POOL_SIZE
      The default maximum number of connections an HTTP/3 client will pool = 1
      See Also:
    • DEFAULT_MAX_WAIT_QUEUE_SIZE

      public static final int DEFAULT_MAX_WAIT_QUEUE_SIZE
      Default max wait queue size = -1 (unbounded)
      See Also:
    • DEFAULT_MAXIMUM_LIFETIME

      public static final int DEFAULT_MAXIMUM_LIFETIME
      Default maximum pooled connection lifetime = 0 (no maximum)
      See Also:
    • 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:
    • 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:
  • Constructor Details

    • 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 Details

    • 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
    • getHttp3MaxSize

      public int getHttp3MaxSize()
      Get the maximum pool size for HTTP/3 connections
      Returns:
      the maximum pool size
    • setHttp3MaxSize

      public PoolOptions setHttp3MaxSize(int max)
      Set the maximum pool size for HTTP/3 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()