@NotThreadSafe public class ClientConfiguration extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_CONNECTION_MAX_IDLE_MILLIS
The default maximum idle time (in milliseconds) for a connection in
the connection pool.
|
static int |
DEFAULT_CONNECTION_TIMEOUT
The default timeout for creating new connections.
|
static long |
DEFAULT_CONNECTION_TTL
The default expiration time (in milliseconds) for a connection in the
connection pool.
|
static int |
DEFAULT_MAX_CONNECTIONS
The default max connection pool size.
|
static int |
DEFAULT_RESPONSE_METADATA_CACHE_SIZE
The default response metadata cache size.
|
static RetryPolicy |
DEFAULT_RETRY_POLICY
Default request retry policy, including the maximum retry count of 3, the
default retry condition and the default back-off strategy.
|
static int |
DEFAULT_SOCKET_TIMEOUT
The default timeout for reading from a connected socket.
|
static boolean |
DEFAULT_TCP_KEEP_ALIVE
The default on whether to use TCP KeepAlive.
|
static boolean |
DEFAULT_USE_GZIP
The default on whether to use gzip compression.
|
static boolean |
DEFAULT_USE_REAPER
The default on whether to use the
IdleConnectionReaper to manage stale connections |
static String |
DEFAULT_USER_AGENT
The default HTTP user agent header for AWS Java SDK clients.
|
Constructor and Description |
---|
ClientConfiguration() |
ClientConfiguration(ClientConfiguration other) |
Modifier and Type | Method and Description |
---|---|
ApacheHttpClientConfig |
getApacheHttpClientConfig()
Returns a non-null object that can be used to specify Apache HTTP client
specific custom configurations.
|
long |
getConnectionMaxIdleMillis()
Returns the maximum amount of time that an idle connection may sit in
the connection pool and still be eligible for reuse.
|
int |
getConnectionTimeout()
Returns the amount of time to wait (in milliseconds) when initially
establishing a connection before giving up and timing out.
|
long |
getConnectionTTL()
Returns the expiration time (in milliseconds) for a connection in the
connection pool.
|
DnsResolver |
getDnsResolver()
Returns the DnsResolver that is used by the client for resolving AWS IP addresses.
|
InetAddress |
getLocalAddress()
Returns the optional local address the client will bind to.
|
int |
getMaxConnections()
Returns the maximum number of allowed open HTTP connections.
|
int |
getMaxErrorRetry()
Returns the maximum number of retry attempts for failed retryable
requests (ex: 5xx error responses from a service).
|
Protocol |
getProtocol()
Returns the protocol (HTTP or HTTPS) to use when connecting to
Amazon Web Services.
|
String |
getProxyDomain()
Returns the optional Windows domain name for configuring an NTLM proxy.
|
String |
getProxyHost()
Returns the optional proxy host the client will connect through.
|
String |
getProxyPassword()
Returns the optional proxy password to use when connecting through a
proxy.
|
int |
getProxyPort()
Returns the optional proxy port the client will connect through.
|
String |
getProxyUsername()
Returns the optional proxy user name to use if connecting through a
proxy.
|
String |
getProxyWorkstation()
Returns the optional Windows workstation name for configuring NTLM proxy
support.
|
int |
getResponseMetadataCacheSize()
Returns the response metadata cache size.
|
RetryPolicy |
getRetryPolicy()
Returns the retry policy upon failed requests.
|
String |
getSignerOverride()
Returns the name of the signature algorithm to use for signing requests
made by this client.
|
int[] |
getSocketBufferSizeHints()
Returns the optional size hints (in bytes) for the low level TCP send and
receive buffers.
|
int |
getSocketTimeout()
Returns the amount of time to wait (in milliseconds) for data to be
transfered over an established, open connection before the connection
times out and is closed.
|
String |
getUserAgent()
Returns the HTTP user agent header to send with all requests.
|
boolean |
isPreemptiveBasicProxyAuth()
Returns whether to attempt to authenticate preemptively against proxy servers
using basic authentication
|
void |
setConnectionMaxIdleMillis(long connectionMaxIdleMillis)
Sets the maximum amount of time that an idle connection may sit in
the connection pool and still be eligible for reuse.
|
void |
setConnectionTimeout(int connectionTimeout)
Sets the amount of time to wait (in milliseconds) when initially
establishing a connection before giving up and timing out.
|
void |
setConnectionTTL(long connectionTTL)
Sets the expiration time (in milliseconds) for a connection in the
connection pool.
|
void |
setDnsResolver(DnsResolver resolver)
Sets the DNS Resolver that should be used to for resolving AWS IP addresses.
|
void |
setLocalAddress(InetAddress localAddress)
Sets the optional local address the client will bind to.
|
void |
setMaxConnections(int maxConnections)
Sets the maximum number of allowed open HTTP connections.
|
void |
setMaxErrorRetry(int maxErrorRetry)
Sets the maximum number of retry attempts for failed retryable requests
(ex: 5xx error responses from services).
|
void |
setPreemptiveBasicProxyAuth(Boolean preemptiveBasicProxyAuth)
Sets whether to attempt to authenticate preemptively against proxy servers
using basic authentication
|
void |
setProtocol(Protocol protocol)
Sets the protocol (i.e.
|
void |
setProxyDomain(String proxyDomain)
Sets the optional Windows domain name for configuration an NTLM proxy.
|
void |
setProxyHost(String proxyHost)
Sets the optional proxy host the client will connect through.
|
void |
setProxyPassword(String proxyPassword)
Sets the optional proxy password to use when connecting through a proxy.
|
void |
setProxyPort(int proxyPort)
Sets the optional proxy port the client will connect through.
|
void |
setProxyUsername(String proxyUsername)
Sets the optional proxy user name to use if connecting through a proxy.
|
void |
setProxyWorkstation(String proxyWorkstation)
Sets the optional Windows workstation name for configuring NTLM proxy
support.
|
void |
setResponseMetadataCacheSize(int responseMetadataCacheSize)
Sets the response metadata cache size.
|
void |
setRetryPolicy(RetryPolicy retryPolicy)
Sets the retry policy upon failed requests.
|
void |
setSignerOverride(String value)
Sets the name of the signature algorithm to use for signing requests
made by this client.
|
void |
setSocketBufferSizeHints(int socketSendBufferSizeHint,
int socketReceiveBufferSizeHint)
Sets the optional size hints (in bytes) for the low level TCP send and
receive buffers.
|
void |
setSocketTimeout(int socketTimeout)
Sets the amount of time to wait (in milliseconds) for data to be
transfered over an established, open connection before the connection
times out and is closed.
|
void |
setUseGzip(boolean use)
Sets whether gzip compression should be used
|
void |
setUserAgent(String userAgent)
Sets the HTTP user agent header to send with all requests.
|
void |
setUseReaper(boolean use)
Sets whether the
IdleConnectionReaper is to be started as a daemon thread |
void |
setUseTcpKeepAlive(boolean use)
Sets whether or not to enable TCP KeepAlive support at the socket level.
|
boolean |
useGzip()
Checks if gzip compression is used
|
boolean |
useReaper()
Checks if the
IdleConnectionReaper is to be started |
boolean |
useTcpKeepAlive()
Returns whether or not TCP KeepAlive support is enabled.
|
ClientConfiguration |
withConnectionMaxIdleMillis(long connectionMaxIdleMillis)
Sets the maximum amount of time that an idle connection may sit in
the connection pool and still be eligible for reuse.
|
ClientConfiguration |
withConnectionTimeout(int connectionTimeout)
Sets the amount of time to wait (in milliseconds) when initially
establishing a connection before giving up and timing out, and returns
the updated ClientConfiguration object so that additional method calls
may be chained together.
|
ClientConfiguration |
withConnectionTTL(long connectionTTL)
Sets the expiration time (in milliseconds) for a connection in the
connection pool.
|
ClientConfiguration |
withDnsResolver(DnsResolver resolver)
Sets the DNS Resolver that should be used to for resolving AWS IP addresses.
|
ClientConfiguration |
withGzip(boolean use)
Sets whether gzip compression should be used
|
ClientConfiguration |
withLocalAddress(InetAddress localAddress)
Sets the optional local address the client will bind to and returns
the updated ClientConfiguration object.
|
ClientConfiguration |
withMaxConnections(int maxConnections)
Sets the maximum number of allowed open HTTP connections and returns the
updated ClientConfiguration object.
|
ClientConfiguration |
withMaxErrorRetry(int maxErrorRetry)
Sets the maximum number of retry attempts for failed retryable requests
(ex: 5xx error responses from services), and returns the updated
ClientConfiguration object.
|
ClientConfiguration |
withPreemptiveBasicProxyAuth(boolean preemptiveBasicProxyAuth)
Sets whether to attempt to authenticate preemptively against proxy
servers using basic authentication, and returns the updated
ClientConfiguration object so that additional method calls may be chained
together.
|
ClientConfiguration |
withProtocol(Protocol protocol)
Sets the protocol (i.e.
|
ClientConfiguration |
withProxyDomain(String proxyDomain)
Sets the optional Windows domain name for configuration an NTLM proxy and
returns a reference to this updated ClientConfiguration object so that
additional method calls can be chained together.
|
ClientConfiguration |
withProxyHost(String proxyHost)
Sets the optional proxy host the client will connect through and returns
the updated ClientConfiguration object.
|
ClientConfiguration |
withProxyPassword(String proxyPassword)
Sets the optional proxy password to use when connecting through a proxy,
and returns the updated ClientConfiguration object.
|
ClientConfiguration |
withProxyPort(int proxyPort)
Sets the optional proxy port the client will connect through and returns
the updated ClientConfiguration object.
|
ClientConfiguration |
withProxyUsername(String proxyUsername)
Sets the optional proxy user name and returns the updated
ClientConfiguration object.
|
ClientConfiguration |
withProxyWorkstation(String proxyWorkstation)
Sets the optional Windows workstation name for configuring NTLM proxy
support, and returns the updated ClientConfiguration object so that
additional method calls can be chained together.
|
ClientConfiguration |
withReaper(boolean use)
Sets whether the
IdleConnectionReaper is to be started as a daemon thread |
ClientConfiguration |
withResponseMetadataCacheSize(int responseMetadataCacheSize)
Sets the response metadata cache size.
|
ClientConfiguration |
withRetryPolicy(RetryPolicy retryPolicy)
Sets the retry policy upon failed requests, and returns the updated
ClientConfiguration object.
|
ClientConfiguration |
withSignerOverride(String value)
Sets the name of the signature algorithm to use for signing requests
made by this client.
|
ClientConfiguration |
withSocketBufferSizeHints(int socketSendBufferSizeHint,
int socketReceiveBufferSizeHint)
Sets the optional size hints (in bytes) for the low level TCP send and
receive buffers, and returns the updated ClientConfiguration object so
that additional method calls may be chained together.
|
ClientConfiguration |
withSocketTimeout(int socketTimeout)
Sets the amount of time to wait (in milliseconds) for data to be
transfered over an established, open connection before the connection
times out and is closed, and returns the updated ClientConfiguration
object so that additional method calls may be chained together.
|
ClientConfiguration |
withTcpKeepAlive(boolean use)
Sets whether or not to enable TCP KeepAlive support at the socket level.
|
ClientConfiguration |
withUserAgent(String userAgent)
Sets the HTTP user agent header used in requests and returns the updated
ClientConfiguration object.
|
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_MAX_CONNECTIONS
public static final String DEFAULT_USER_AGENT
public static final RetryPolicy DEFAULT_RETRY_POLICY
Note this default policy might be overridden by a service-specific
default policy, if the user doesn't provide a custom RetryPolicy
implementation by setRetryPolicy(RetryPolicy)
. For example,
AmazonDynamoDBClient by default uses a different retry policy
PredefinedRetryPolicies.DYNAMODB_DEFAULT
.
public static final boolean DEFAULT_USE_REAPER
IdleConnectionReaper
to manage stale connectionsIdleConnectionReaper
,
Constant Field Valuespublic static final boolean DEFAULT_USE_GZIP
public static final long DEFAULT_CONNECTION_TTL
public static final long DEFAULT_CONNECTION_MAX_IDLE_MILLIS
public static final boolean DEFAULT_TCP_KEEP_ALIVE
public static final int DEFAULT_RESPONSE_METADATA_CACHE_SIZE
public ClientConfiguration()
public ClientConfiguration(ClientConfiguration other)
public Protocol getProtocol()
The default configuration is to use HTTPS for all requests for increased security.
Individual clients can also override this setting by explicitly including
the protocol as part of the endpoint URL when calling
AmazonWebServiceClient.setEndpoint(String)
.
public void setProtocol(Protocol protocol)
The default configuration is to use HTTPS for all requests for increased security.
Individual clients can also override this setting by explicitly including
the protocol as part of the endpoint URL when calling
AmazonWebServiceClient.setEndpoint(String)
.
protocol
- The protocol to use when connecting to Amazon Web Services.public ClientConfiguration withProtocol(Protocol protocol)
The default configuration is to use HTTPS for all requests for increased security.
Individual clients can also override this setting by explicitly including
the protocol as part of the endpoint URL when calling
AmazonWebServiceClient.setEndpoint(String)
.
protocol
- The protocol to use when connecting to Amazon Web Services.public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections
- The maximum number of allowed open HTTP connections.public ClientConfiguration withMaxConnections(int maxConnections)
maxConnections
- The maximum number of allowed open HTTP connections.public String getUserAgent()
public void setUserAgent(String userAgent)
userAgent
- The user agent string to use when sending requests.public ClientConfiguration withUserAgent(String userAgent)
userAgent
- The user agent string to use when sending requests.public InetAddress getLocalAddress()
public void setLocalAddress(InetAddress localAddress)
localAddress
- The local address the client will bind to.public ClientConfiguration withLocalAddress(InetAddress localAddress)
localAddress
- The local address the client will bind to.public String getProxyHost()
public void setProxyHost(String proxyHost)
proxyHost
- The proxy host the client will connect through.public ClientConfiguration withProxyHost(String proxyHost)
proxyHost
- The proxy host the client will connect through.public int getProxyPort()
public void setProxyPort(int proxyPort)
proxyPort
- The proxy port the client will connect through.public ClientConfiguration withProxyPort(int proxyPort)
proxyPort
- The proxy port the client will connect through.public String getProxyUsername()
public void setProxyUsername(String proxyUsername)
proxyUsername
- The proxy user name to use if connecting through a proxy.public ClientConfiguration withProxyUsername(String proxyUsername)
proxyUsername
- The proxy user name to use if connecting through a proxy.public String getProxyPassword()
public void setProxyPassword(String proxyPassword)
proxyPassword
- The password to use when connecting through a proxy.public ClientConfiguration withProxyPassword(String proxyPassword)
proxyPassword
- The password to use when connecting through a proxy.public String getProxyDomain()
public void setProxyDomain(String proxyDomain)
proxyDomain
- The optional Windows domain name for configuring an NTLM
proxy.public ClientConfiguration withProxyDomain(String proxyDomain)
proxyDomain
- The optional Windows domain name for configuring an NTLM
proxy.public String getProxyWorkstation()
public void setProxyWorkstation(String proxyWorkstation)
proxyWorkstation
- The optional Windows workstation name for configuring NTLM
proxy support.public ClientConfiguration withProxyWorkstation(String proxyWorkstation)
proxyWorkstation
- The optional Windows workstation name for configuring NTLM
proxy support.public RetryPolicy getRetryPolicy()
public void setRetryPolicy(RetryPolicy retryPolicy)
setMaxErrorRetry(int)
.retryPolicy
- The retry policy upon failed requests.public ClientConfiguration withRetryPolicy(RetryPolicy retryPolicy)
setMaxErrorRetry(int)
retryPolicy
- The retry policy upon failed requests.public int getMaxErrorRetry()
setMaxErrorRetry(int)
, in which case the configured RetryPolicy
will be used to control the retry count.setMaxErrorRetry(int)
.public void setMaxErrorRetry(int maxErrorRetry)
maxErrorRetry
- The maximum number of retry attempts for failed retryable
requests. This value should not be negative.public ClientConfiguration withMaxErrorRetry(int maxErrorRetry)
maxErrorRetry
- The maximum number of retry attempts for failed retryable
requests. This value should not be negative.public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
socketTimeout
- The amount of time to wait (in milliseconds) for data to be
transfered over an established, open connection before the
connection is times out and is closed.public ClientConfiguration withSocketTimeout(int socketTimeout)
socketTimeout
- The amount of time to wait (in milliseconds) for data to be
transfered over an established, open connection before the
connection is times out and is closed.public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- The amount of time to wait (in milliseconds) when initially
establishing a connection before giving up and timing out.public ClientConfiguration withConnectionTimeout(int connectionTimeout)
connectionTimeout
- the amount of time to wait (in milliseconds) when initially
establishing a connection before giving up and timing out.public boolean useReaper()
IdleConnectionReaper
is to be startedIdleConnectionReaper
is to be startedpublic void setUseReaper(boolean use)
IdleConnectionReaper
is to be started as a daemon threaduse
- whether the IdleConnectionReaper
is to be started as a daemon threadIdleConnectionReaper
public ClientConfiguration withReaper(boolean use)
IdleConnectionReaper
is to be started as a daemon threaduse
- the IdleConnectionReaper
is to be started as a daemon threadpublic boolean useGzip()
public void setUseGzip(boolean use)
use
- whether gzip compression should be usedpublic ClientConfiguration withGzip(boolean use)
use
- whether gzip compression should be usedpublic int[] getSocketBufferSizeHints()
The optimal TCP buffer sizes for a particular application are highly dependent on network configuration and operating system configuration and capabilities. For example, most modern operating systems provide auto-tuning functionality for TCP buffer sizes, which can have a big impact on performance for TCP connections that are held open long enough for the auto-tuning to optimize buffer sizes.
Large buffer sizes (ex: 2MB) will allow the operating system to buffer more data in memory without requiring the remote server to acknowledge receipt of that information, so can be particularly useful when the network has high latency.
This is only a hint, and the operating system may choose not to honor it. When using this option, users should always check the operating system's configured limits and defaults. Most OS's have a maximum TCP buffer size limit configured, and won't let you go beyond that limit unless you explicitly raise the max TCP buffer size limit.
There are many resources available online to help with configuring TCP buffer sizes and operating system specific TCP settings, including:
public void setSocketBufferSizeHints(int socketSendBufferSizeHint, int socketReceiveBufferSizeHint)
The optimal TCP buffer sizes for a particular application are highly dependent on network configuration and operating system configuration and capabilities. For example, most modern operating systems provide auto-tuning functionality for TCP buffer sizes, which can have a big impact on performance for TCP connections that are held open long enough for the auto-tuning to optimize buffer sizes.
Large buffer sizes (ex: 2MB) will allow the operating system to buffer more data in memory without requiring the remote server to acknowledge receipt of that information, so can be particularly useful when the network has high latency.
This is only a hint, and the operating system may choose not to honor it. When using this option, users should always check the operating system's configured limits and defaults. Most OS's have a maximum TCP buffer size limit configured, and won't let you go beyond that limit unless you explicitly raise the max TCP buffer size limit.
There are many resources available online to help with configuring TCP buffer sizes and operating system specific TCP settings, including:
socketSendBufferSizeHint
- The size hint (in bytes) for the low level TCP send buffer.socketReceiveBufferSizeHint
- The size hint (in bytes) for the low level TCP receive buffer.public ClientConfiguration withSocketBufferSizeHints(int socketSendBufferSizeHint, int socketReceiveBufferSizeHint)
This is an advanced option for advanced users who want to tune low level TCP parameters to try and squeeze out more performance.
The optimal TCP buffer sizes for a particular application are highly dependent on network configuration and operating system configuration and capabilities. For example, most modern operating systems provide auto-tuning functionality for TCP buffer sizes, which can have a big impact on performance for TCP connections that are held open long enough for the auto-tuning to optimize buffer sizes.
Large buffer sizes (ex: 2MB) will allow the operating system to buffer more data in memory without requiring the remote server to acknowledge receipt of that information, so can be particularly useful when the network has high latency.
This is only a hint, and the operating system may choose not to honor it. When using this option, users should always check the operating system's configured limits and defaults. Most OS's have a maximum TCP buffer size limit configured, and won't let you go beyond that limit unless you explicitly raise the max TCP buffer size limit.
There are many resources available online to help with configuring TCP buffer sizes and operating system specific TCP settings, including:
socketSendBufferSizeHint
- The size hint (in bytes) for the low level TCP send buffer.socketReceiveBufferSizeHint
- The size hint (in bytes) for the low level TCP receive buffer.public String getSignerOverride()
Most users do not need to concern themselves with which signature algorithm is being used, as the defaults will be sufficient. This setting exists only so advanced users can opt in to newer signature protocols which have not yet been made the default for a particular service/region.
Not all services support all signature algorithms, and configuring an unsupported signature algorithm will lead to authentication failures. Use me at your own risk, and only after consulting the documentation for the service to ensure it actually does supports your chosen algorithm.
If non-null, the name returned from this method is used to look up
a Signer
class implementing the chosen algorithm by the
com.amazonaws.auth.SignerFactory
class.
public void setSignerOverride(String value)
Most users do not need to concern themselves with which signature algorithm is being used, as the defaults will be sufficient. This setting exists only so advanced users can opt in to newer signature protocols which have not yet been made the default for a particular service/region.
Not all services support all signature algorithms, and configuring an unsupported signature algorithm will lead to authentication failures. Use me at your own risk, and only after consulting the documentation for the service to ensure it actually does supports your chosen algorithm.
If non-null, the name returned from this method is used to look up
a Signer
class implementing the chosen algorithm by the
com.amazonaws.auth.SignerFactory
class.
value
- The signature algorithm to use for this client, or null
to use the default.public ClientConfiguration withSignerOverride(String value)
Most users do not need to concern themselves with which signature algorithm is being used, as the defaults will be sufficient. This setting exists only so advanced users can opt in to newer signature protocols which have not yet been made the default for a particular service/region.
Not all services support all signature algorithms, and configuring an unsupported signature algorithm will lead to authentication failures. Use me at your own risk, and only after consulting the documentation for the service to ensure it actually does supports your chosen algorithm.
If non-null, the name returned from this method is used to look up
a Signer
class implementing the chosen algorithm by the
com.amazonaws.auth.SignerFactory
class.
value
- The signature algorithm to use for this client, or null
to use the default.public boolean isPreemptiveBasicProxyAuth()
public void setPreemptiveBasicProxyAuth(Boolean preemptiveBasicProxyAuth)
preemptiveBasicProxyAuth
- Whether to authenticate preemptively against proxy server.public ClientConfiguration withPreemptiveBasicProxyAuth(boolean preemptiveBasicProxyAuth)
preemptiveBasicProxyAuth
- Whether to authenticate preemptively against proxy server.public long getConnectionTTL()
Tuning this setting down (together with an appropriately-low setting for Java's DNS cache TTL) ensures that your application will quickly rotate over to new IP addresses when the service begins announcing them through DNS, at the cost of having to re-establish new connections more frequently.
public void setConnectionTTL(long connectionTTL)
Tuning this setting down (together with an appropriately-low setting for Java's DNS cache TTL) ensures that your application will quickly rotate over to new IP addresses when the service begins announcing them through DNS, at the cost of having to re-establish new connections more frequently.
By default, it is set to {@code -1], i.e. connections do not expire.
connectionTTL
- the connection TTL, in millisecondspublic ClientConfiguration withConnectionTTL(long connectionTTL)
Tuning this setting down (together with an appropriately-low setting for Java's DNS cache TTL) ensures that your application will quickly rotate over to new IP addresses when the service begins announcing them through DNS, at the cost of having to re-establish new connections more frequently.
By default, it is set to -1
, i.e. connections do not expire.
connectionTTL
- the connection TTL, in millisecondspublic long getConnectionMaxIdleMillis()
Tuning this setting down reduces the likelihood of a race condition (wherein you begin sending a request down a connection which appears to be healthy, but before it arrives the service decides the connection has been idle for too long and closes it) at the cost of having to re-establish new connections more frequently.
public void setConnectionMaxIdleMillis(long connectionMaxIdleMillis)
Tuning this setting down reduces the likelihood of a race condition (wherein you begin sending a request down a connection which appears to be healthy, but before it arrives the service decides the connection has been idle for too long and closes it) at the cost of having to re-establish new connections more frequently.
By default, it is set to one minute (60000ms).
connectionMaxIdleMillis
- the connection maximum idle time, in
millisecondspublic ClientConfiguration withConnectionMaxIdleMillis(long connectionMaxIdleMillis)
Tuning this setting down reduces the likelihood of a race condition (wherein you begin sending a request down a connection which appears to be healthy, but before it arrives the service decides the connection has been idle for too long and closes it) at the cost of having to re-establish new connections more frequently.
By default, it is set to one minute (60000ms).
connectionMaxIdleMillis
- the connection maximum idle time, in
millisecondspublic boolean useTcpKeepAlive()
public void setUseTcpKeepAlive(boolean use)
public ClientConfiguration withTcpKeepAlive(boolean use)
public DnsResolver getDnsResolver()
public void setDnsResolver(DnsResolver resolver)
public ClientConfiguration withDnsResolver(DnsResolver resolver)
public int getResponseMetadataCacheSize()
public void setResponseMetadataCacheSize(int responseMetadataCacheSize)
responseMetadataCacheSize
- maximum cache size.public ClientConfiguration withResponseMetadataCacheSize(int responseMetadataCacheSize)
responseMetadataCacheSize
- maximum cache size.public ApacheHttpClientConfig getApacheHttpClientConfig()
Copyright © 2015. All rights reserved.