Class ConnectionConfig

  • All Implemented Interfaces:
    java.lang.Cloneable

    @Contract(threading=IMMUTABLE)
    public class ConnectionConfig
    extends java.lang.Object
    implements java.lang.Cloneable
    Immutable class encapsulating connection initialization and management settings.
    Since:
    5.2
    • Field Detail

      • DEFAULT_CONNECT_TIMEOUT

        private static final org.apache.hc.core5.util.Timeout DEFAULT_CONNECT_TIMEOUT
      • DEFAULT

        public static final ConnectionConfig DEFAULT
        The default connection configuration.
        • Timeout connectTimeout: 3 minutes
        • Timeout socketTimeout: null (undefined)
        • Timeout idleTimeout: null (undefined)
        • TimeValue validateAfterInactivity: null (undefined)
        • TimeValue timeToLive: null (undefined)
      • connectTimeout

        private final org.apache.hc.core5.util.Timeout connectTimeout
      • socketTimeout

        private final org.apache.hc.core5.util.Timeout socketTimeout
      • idleTimeout

        private final org.apache.hc.core5.util.Timeout idleTimeout
      • validateAfterInactivity

        private final org.apache.hc.core5.util.TimeValue validateAfterInactivity
      • timeToLive

        private final org.apache.hc.core5.util.TimeValue timeToLive
    • Constructor Detail

      • ConnectionConfig

        protected ConnectionConfig()
        Intended for CDI compatibility
      • ConnectionConfig

        ConnectionConfig​(org.apache.hc.core5.util.Timeout connectTimeout,
                         org.apache.hc.core5.util.Timeout socketTimeout,
                         org.apache.hc.core5.util.Timeout idleTimeout,
                         org.apache.hc.core5.util.TimeValue validateAfterInactivity,
                         org.apache.hc.core5.util.TimeValue timeToLive)
    • Method Detail

      • getSocketTimeout

        public org.apache.hc.core5.util.Timeout getSocketTimeout()
        Gets the default socket timeout value for I/O operations on connections created by this configuration. A timeout value of zero is interpreted as an infinite timeout.
        Returns:
        the default socket timeout value, defaults to null.
        See Also:
        ConnectionConfig.Builder.setSocketTimeout(Timeout)
      • getConnectTimeout

        public org.apache.hc.core5.util.Timeout getConnectTimeout()
        Gets the timeout until the target endpoint acknowledges accepting the connection request.

        Note that isn't the same time as the new connection being fully established. An HTTPS connection cannot be considered fully established until the TLS handshake has been successfully completed.

        A timeout value of zero is interpreted as an infinite timeout.

        Returns:
        the timeout until the target endpoint acknowledges accepting the connection request, defaults to 3 minutes.
        See Also:
        ConnectionConfig.Builder.setConnectTimeout(Timeout)
      • getIdleTimeout

        public org.apache.hc.core5.util.Timeout getIdleTimeout()
        Gets the maximum period of idleness for a connection.

        Implementations can use this value to discard connections that have been idle for too long.

        Returns:
        the maximum period of idleness for a connection, defaults to null.
        See Also:
        ConnectionConfig.Builder.setIdleTimeout(Timeout)
      • getValidateAfterInactivity

        public org.apache.hc.core5.util.TimeValue getValidateAfterInactivity()
        Gets the period of inactivity after which persistent connections must be re-validated.
        Returns:
        the period of inactivity after which persistent connections must be re-validated, defaults to null.
        See Also:
        ConnectionConfig.Builder.setValidateAfterInactivity(TimeValue)
      • getTimeToLive

        public org.apache.hc.core5.util.TimeValue getTimeToLive()
        Gets the total span of time connections can be kept alive or execute requests.
        Returns:
        the total span of time connections can be kept alive or execute requests, defaults to null.
        See Also:
        (TimeValue)
      • clone

        protected ConnectionConfig clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object