Class HttpClientConnectionPoolConfig

  • Direct Known Subclasses:
    RestClientConfig

    public class HttpClientConnectionPoolConfig
    extends io.rxmicro.http.HttpConfig
    Configures connection pool settings for http client.
    Since:
    0.8
    Author:
    nedis
    • Field Detail

      • DEFAULT_POOL_MAX_CONNECTIONS

        public static final int DEFAULT_POOL_MAX_CONNECTIONS
        Default max connections. Fallback to available number of processors (but with a minimum value of 16)
      • DEFAULT_POOL_ACQUIRE_TIMEOUT

        public static final Duration DEFAULT_POOL_ACQUIRE_TIMEOUT
        Default acquisition timeout (milliseconds) before error. If -1 will never wait to acquire before opening a new connection in an unbounded fashion
      • EVICT_IN_BACKGROUND_DISABLED

        public static final Duration EVICT_IN_BACKGROUND_DISABLED
        Providing an evictionInterval of zero means the background eviction is disabled.
      • DEFAULT_POOL_LEASING_STRATEGY

        public static final LeasingStrategy DEFAULT_POOL_LEASING_STRATEGY
        Default leasing strategy.
    • Constructor Detail

      • HttpClientConnectionPoolConfig

        protected HttpClientConnectionPoolConfig()
        This is basic class designed for extension only.
    • Method Detail

      • getEvictionInterval

        public Duration getEvictionInterval()
        Returns the options to use for configuring connection provider background eviction.
        Returns:
        the options to use for configuring connection provider background eviction.
      • setEvictionInterval

        public HttpClientConnectionPoolConfig setEvictionInterval​(Duration evictionInterval)
        Set the options to use for configuring connection provider background eviction. When a background eviction is enabled, the connection pool is regularly checked for connections, that are applicable for removal. Default to EVICT_IN_BACKGROUND_DISABLED - the background eviction is disabled. Providing an evictionInterval of zero means the background eviction is disabled.
        Parameters:
        evictionInterval - specifies the interval to be used for checking the connection pool, (resolution: ns)
        Returns:
        the reference to this HttpClientConnectionPoolConfig instance
        Throws:
        NullPointerException - if evictionInterval is null
      • getMaxConnections

        public int getMaxConnections()
        Returns the options to use for configuring connection provider maximum connections per connection pool.
        Returns:
        the options to use for configuring connection provider maximum connections per connection pool.
      • getPendingAcquireMaxCount

        public OptionalInt getPendingAcquireMaxCount()
        Returns the options to use for configuring connection provider the maximum number of registered requests for acquire to keep in a pending queue.
        Returns:
        the options to use for configuring connection provider the maximum number of registered requests for acquire to keep in a pending queue.
      • setPendingAcquireMaxCount

        public HttpClientConnectionPoolConfig setPendingAcquireMaxCount​(int pendingAcquireMaxCount)
        Set the options to use for configuring connection provider the maximum number of registered requests for acquire to keep in a pending queue. When invoked with -1 the pending queue will not have upper limit. Default to 2 * max connections.
        Parameters:
        pendingAcquireMaxCount - the maximum number of registered requests for acquire to keep in a pending queue
        Returns:
        the reference to this HttpClientConnectionPoolConfig instance
        Throws:
        IllegalArgumentException - if pendingAcquireMaxCount is negative
      • getPendingAcquireTimeout

        public Duration getPendingAcquireTimeout()
        Returns the options to use for configuring connection provider acquire timeout (resolution: ms).
        Returns:
        the options to use for configuring connection provider acquire timeout (resolution: ms).
      • getMaxIdleTime

        public Optional<Duration> getMaxIdleTime()
        Returns the options to use for configuring connection provider max idle time (resolution: ms).
        Returns:
        the options to use for configuring connection provider max idle time (resolution: ms).
      • getMaxLifeTime

        public Optional<Duration> getMaxLifeTime()
        Returns the options to use for configuring connection provider max life time (resolution: ms).
        Returns:
        the options to use for configuring connection provider max life time (resolution: ms).
      • getLeasingStrategy

        public LeasingStrategy getLeasingStrategy()
        Returns the configured leasing strategy.
        Returns:
        the configured leasing strategy.
      • toString

        public String toString()
        Overrides:
        toString in class io.rxmicro.http.HttpConfig