Class ConnectionConfig
java.lang.Object
org.apache.hc.client5.http.config.ConnectionConfig
- All Implemented Interfaces:
Cloneable
Immutable class encapsulating connection initialization and management settings.
- Since:
- 5.2
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConnectionConfigThe default connection configuration. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ConnectionConfigclone()static ConnectionConfig.Buildercopy(ConnectionConfig config) Creates a new builder forConnectionConfigbased on an existing instance.static ConnectionConfig.Buildercustom()Creates a new builder forConnectionConfig.org.apache.hc.core5.util.TimeoutGets the timeout until the target endpoint acknowledges accepting the connection request.org.apache.hc.core5.util.TimeoutGets the maximum period of idleness for a connection.org.apache.hc.core5.util.TimeoutGets the default socket timeout value for I/O operations on connections created by this configuration.org.apache.hc.core5.util.TimeValueGets the total span of time connections can be kept alive or execute requests.org.apache.hc.core5.util.TimeValueGets the period of inactivity after which persistent connections must be re-validated.toString()
-
Field Details
-
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)
-
-
Constructor Details
-
ConnectionConfig
protected ConnectionConfig()Intended for CDI compatibility
-
-
Method Details
-
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:
-
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:
-
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:
-
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:
-
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:
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
toString
-
custom
Creates a new builder forConnectionConfig.- Returns:
- a new builder for
ConnectionConfig.
-
copy
Creates a new builder forConnectionConfigbased on an existing instance.- Parameters:
config- the instance to copy.- Returns:
- a new builder for
ConnectionConfig.
-