Top Description Inners Fields Constructors Methods
org.apache.hc.client5.http.config

public Class ConnectionConfig

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Annotations
@Contract
threading:IMMUTABLE
Imports
java.util.concurrent.TimeUnit, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.util.TimeValue, .Timeout

Immutable class encapsulating connection initialization and management settings.
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final Timeout
public static final ConnectionConfig
private static final Timeout
private final Timeout
private final TimeValue
private final TimeValue

Constructor Summary

AccessConstructor and Description
protected
ConnectionConfig()

Intended for CDI compatibility

pack-priv
ConnectionConfig(final Timeout connectTimeout, final Timeout socketTimeout, final TimeValue validateAfterInactivity, final TimeValue timeToLive)

Method Summary

Modifier and TypeMethod and Description
protected ConnectionConfig
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public static ConnectionConfig.Builder
copy(final ConnectionConfig config)

public static ConnectionConfig.Builder
public Timeout
public Timeout
public TimeValue
public TimeValue
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

connectTimeoutback to summary
private final Timeout connectTimeout
DEFAULTback to summary
public static final ConnectionConfig DEFAULT
DEFAULT_CONNECT_TIMEOUTback to summary
private static final Timeout DEFAULT_CONNECT_TIMEOUT
socketTimeoutback to summary
private final Timeout socketTimeout
timeToLiveback to summary
private final TimeValue timeToLive
validateAfterInactivityback to summary
private final TimeValue validateAfterInactivity

Constructor Detail

ConnectionConfigback to summary
protected ConnectionConfig()

Intended for CDI compatibility

ConnectionConfigback to summary
pack-priv ConnectionConfig(final Timeout connectTimeout, final Timeout socketTimeout, final TimeValue validateAfterInactivity, final TimeValue timeToLive)

Method Detail

cloneback to summary
protected ConnectionConfig clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:ConnectionConfig

a clone of this instance.

Annotations
@Override
Exceptions
CloneNotSupportedException:
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
copyback to summary
public static ConnectionConfig.Builder copy(final ConnectionConfig config)
customback to summary
public static ConnectionConfig.Builder custom()
getConnectTimeoutback to summary
public Timeout getConnectTimeout()
See Also
Builder#setConnectTimeout(Timeout)
getSocketTimeoutback to summary
public Timeout getSocketTimeout()
See Also
Builder#setSocketTimeout(Timeout)
getTimeToLiveback to summary
public TimeValue getTimeToLive()
See Also
(TimeValue)
getValidateAfterInactivityback to summary
public TimeValue getValidateAfterInactivity()
See Also
Builder#setValidateAfterInactivity(TimeValue)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.apache.hc.client5.http.config back to summary

public Class ConnectionConfig.Builder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Timeout
private Timeout
private TimeValue
private TimeValue

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ConnectionConfig
public ConnectionConfig.Builder
setConnectTimeout(final Timeout connectTimeout)

Determines the timeout until a new connection is fully established.

public ConnectionConfig.Builder
setConnectTimeout(final long connectTimeout, final TimeUnit timeUnit)

public ConnectionConfig.Builder
setSocketTimeout(final int soTimeout, final TimeUnit timeUnit)

public ConnectionConfig.Builder

Returns:

the default socket timeout value for I/O operations.
setSocketTimeout
(final Timeout soTimeout)

Determines the default socket timeout value for I/O operations.

public ConnectionConfig.Builder
setTimeToLive(final TimeValue timeToLive)

Defines the total span of time connections can be kept alive or execute requests.

public ConnectionConfig.Builder
setTimeToLive(final long timeToLive, final TimeUnit timeUnit)

public ConnectionConfig.Builder
setValidateAfterInactivity(final TimeValue validateAfterInactivity)

Defines period of inactivity after which persistent connections must be re-validated prior to being leased to the consumer.

public ConnectionConfig.Builder
setValidateAfterInactivity(final long validateAfterInactivity, final TimeUnit timeUnit)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectTimeoutback to summary
private Timeout connectTimeout
socketTimeoutback to summary
private Timeout socketTimeout
timeToLiveback to summary
private TimeValue timeToLive
validateAfterInactivityback to summary
private TimeValue validateAfterInactivity

Constructor Detail

Builderback to summary
pack-priv Builder()

Method Detail

buildback to summary
public ConnectionConfig build()
setConnectTimeoutback to summary
public ConnectionConfig.Builder setConnectTimeout(final Timeout connectTimeout)

Determines the timeout until a new connection is fully established.

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

Default: 3 minutes

setConnectTimeoutback to summary
public ConnectionConfig.Builder setConnectTimeout(final long connectTimeout, final TimeUnit timeUnit)
See Also
setConnectTimeout(Timeout)
setSocketTimeoutback to summary
public ConnectionConfig.Builder setSocketTimeout(final int soTimeout, final TimeUnit timeUnit)
See Also
setSocketTimeout(Timeout)
setSocketTimeoutback to summary
public ConnectionConfig.Builder setSocketTimeout(final Timeout soTimeout)

Determines the default socket timeout value for I/O operations.

Default: null (undefined)

Returns:ConnectionConfig.Builder

the default socket timeout value for I/O operations.

setTimeToLiveback to summary
public ConnectionConfig.Builder setTimeToLive(final TimeValue timeToLive)

Defines the total span of time connections can be kept alive or execute requests.

Default: null (undefined)

setTimeToLiveback to summary
public ConnectionConfig.Builder setTimeToLive(final long timeToLive, final TimeUnit timeUnit)
See Also
setTimeToLive(TimeValue)
setValidateAfterInactivityback to summary
public ConnectionConfig.Builder setValidateAfterInactivity(final TimeValue validateAfterInactivity)

Defines period of inactivity after which persistent connections must be re-validated prior to being leased to the consumer. Negative values passed to this method disable connection validation.

Default: null (undefined)

setValidateAfterInactivityback to summary
public ConnectionConfig.Builder setValidateAfterInactivity(final long validateAfterInactivity, final TimeUnit timeUnit)
See Also
setValidateAfterInactivity(TimeValue)