public final class ClientConfig extends Object
Modifier and Type | Field and Description |
---|---|
protected static long |
DEFAULT_CLUSTER_UPDATE_INTERVAL_MS |
protected static long |
DEFAULT_CLUSTER_UPDATE_THRESHOLD_MS |
protected static long |
DEFAULT_CONNECT_TIMEOUT_MS |
protected static long |
DEFAULT_HEALTH_CHECK_INTERVAL_MS |
protected static long |
DEFAULT_HEALTH_CHECK_TIMEOUT_MS |
protected static long |
DEFAULT_IDLE_CONNECTION_TIMEOUT_MS |
protected static int |
DEFAULT_MAX_PENDING_CONNECTIONS_PER_HOST |
protected static long |
DEFAULT_MAX_RETRY_DELAY_MS |
protected static int |
DEFAULT_MIN_IDLE_CONNECTION_SIZE |
protected static int |
DEFAULT_READ_RETRIES |
protected static long |
DEFAULT_REQUEST_TIMEOUT_MS |
protected static long |
DEFAULT_THREAD_KEEP_ALIVE_MS |
protected static int |
DEFAULT_UNHEALTHY_CONSECUTIVE_ERROR_COUNT |
protected static int |
DEFAULT_WRITE_RETRIES |
AWSCredentialsProvider |
mProvider
Deprecated.
|
String |
mRegion
Deprecated.
|
Constructor and Description |
---|
ClientConfig()
Constructs a new default initialized instance
|
Modifier and Type | Method and Description |
---|---|
long |
getClusterUpdateInterval()
Returns the interval between polling of cluster members for membership changes.
|
long |
getClusterUpdateThreshold()
Returns the threshold below which the cluster will not be polled for membership changes.
|
long |
getConnectTimeout()
Returns the timeout for connections with the DAX cluster.
|
AWSCredentialsProvider |
getCredentialsProvider()
Sets the credentials provider used to sign requests to the DAX cluster.
|
long |
getHealthCheckInterval()
Returns the interval between health checks with the DAX cluster.
|
long |
getHealthCheckTimeout()
Returns the health check timeout for connections with the DAX cluster.
|
com.amazon.dax.client.HostPort[] |
getHostPorts()
Returns the DAX cluster discovery endpoints.
|
com.amazon.dax.client.DaxHostnameVerifier |
getHostVerifier()
Returns the DAX cluster hostname verifier
|
long |
getIdleConnectionTimeout()
Returns the timeout for idle connections with the DAX cluster.
|
int |
getMaxPendingConnectsPerHost()
Returns the maximum number of pending connections per DAX node.
|
long |
getMaxRetryDelay()
Returns the maximum delay between retries when the cluster is believed to be recovering.
|
int |
getMinIdleConnectionSize()
Returns the minimum number of idling connections with the DAX cluster.
|
int |
getReadRetries()
Returns the number of times to retry reads (not counting the initial try).
|
String |
getRegion()
Returns the AWS region.
|
long |
getRequestTimeout()
Returns the request timeout for connections with the DAX cluster.
|
long |
getThreadKeepAlive()
Returns the health check thread keep alive time.
|
int |
getUnhealthyConsecutiveErrorCount()
Returns the number of errors required to signal node unhealthy within health check interval
|
int |
getWriteRetries()
Returns the number of times to retry writes (not counting the initial try).
|
boolean |
isEncrypted()
Returns if TLS endpoint is used.
|
void |
setClusterUpdateInterval(long clusterUpdateInterval,
TimeUnit unit)
Sets the interval between polling of cluster members for membership changes.
|
void |
setClusterUpdateThreshold(long clusterUpdateThreshold,
TimeUnit unit)
Sets the threshold below which explicit unforced cluster refresh
requests will not be attempted to poll for membership changes.
|
void |
setConnectTimeout(long connectTimeout,
TimeUnit unit)
Sets the timeout for connections with the DAX cluster.
|
void |
setCredentialsProvider(AWSCredentialsProvider provider)
Sets the credentials provider used to sign requests to the DAX cluster.
|
void |
setEndpoints(boolean skipHostnameVerification,
String... hosts)
Sets the DAX cluster discovery endpoints.
|
void |
setEndpoints(String... hosts)
Sets the DAX cluster discovery endpoints.
|
void |
setHealthCheckInterval(long healthCheckInterval,
TimeUnit unit)
Sets the interval between health checks with the DAX cluster.
|
void |
setHealthCheckTimeout(long healthCheckTimeout,
TimeUnit unit)
Sets the health check timeout for connections with the DAX cluster.
|
void |
setIdleConnectionTimeout(long idleTimeout,
TimeUnit unit)
Sets the timeout for idle connections with the DAX cluster.
|
void |
setMaxPendingConnectsPerHost(int maxPending)
Sets the maximum number of pending connections per DAX node.
|
void |
setMaxRetryDelay(long retryDelayCap,
TimeUnit unit)
Sets the maximum delay between retries when the cluster is believed to be recovering.
|
void |
setMinIdleConnectionSize(int size)
Sets the minimum number of idling connections with the DAX cluster.
|
void |
setReadRetries(int readRetries)
Sets the number of times to retry reads (not counting the initial try).
|
void |
setRegion(Region region)
Sets the AWS region.
|
void |
setRegion(String region)
Sets the AWS region.
|
void |
setRequestTimeout(long RequestTimeout,
TimeUnit unit)
Sets the request timeout for connections with the DAX cluster.
|
void |
setThreadKeepAlive(long threadKeepAlive,
TimeUnit unit)
Sets the health check thread keep alive time.
|
void |
setUnhealthyConsecutiveErrorCount(int errorCount)
Sets the number of consecutive errors required to signal node unhealthy within health check interval.
|
void |
setWriteRetries(int writeRetries)
Sets the number of times to retry writes (not counting the initial try).
|
ClientConfig |
withClusterUpdateInterval(long clusterUpdateInterval,
TimeUnit unit)
Sets the interval between polling of cluster members for membership changes.
|
ClientConfig |
withClusterUpdateThreshold(long clusterUpdateThreshold,
TimeUnit unit)
Sets the threshold below which explicit unforced cluster refresh
requests will not be attempted to poll for membership changes.
|
ClientConfig |
withConnectTimeout(long connectTimeout,
TimeUnit unit)
Sets the timeout for connections with the DAX cluster.
|
ClientConfig |
withCredentialsProvider(AWSCredentialsProvider provider)
Sets the credentials provider used to sign requests to the DAX cluster.
|
ClientConfig |
withEndpoints(boolean skipHostnameVerification,
String... hosts)
Sets the DAX cluster discovery endpoints.
|
ClientConfig |
withEndpoints(String... hosts)
Sets the DAX cluster discovery endpoints.
|
ClientConfig |
withHealthCheckInterval(long healthCheckInterval,
TimeUnit unit)
Sets the interval between health checks with the DAX cluster.
|
ClientConfig |
withHealthCheckTimeout(long healthCheckTimeout,
TimeUnit unit)
Sets the health check timeout for connections with the DAX cluster.
|
ClientConfig |
withIdleConnectionTimeout(long idleTimeout,
TimeUnit unit)
Sets the timeout for idle connections with the DAX cluster.
|
ClientConfig |
withMaxPendingConnectsPerHost(int maxPending)
Sets the maximum number of pending connections per DAX node.
|
ClientConfig |
withMaxRetryDelay(long retryDelayCap,
TimeUnit unit)
Sets the maximum delay between retries when the cluster is believed to be recovering.
|
ClientConfig |
withMinIdleConnectionSize(int size)
Sets the minimum number of idling connections with the DAX cluster.
|
ClientConfig |
withReadRetries(int readRetries)
Sets the number of times to retry reads (not counting the initial try).
|
ClientConfig |
withRegion(Region region)
Sets the AWS region.
|
ClientConfig |
withRegion(String region)
Sets the AWS region.
|
ClientConfig |
withRequestTimeout(long RequestTimeout,
TimeUnit unit)
Sets the request timeout for connections with the DAX cluster.
|
ClientConfig |
withThreadKeepAlive(long threadKeepAlive,
TimeUnit unit)
Sets the health check thread keep alive time.
|
ClientConfig |
withUnhealthyConsecutiveErrorCount(int errorCount)
Sets the number of consecutive errors required to signal node unhealthy within health check interval.
|
ClientConfig |
withWriteRetries(int writeRetries)
Sets the number of times to retry writes (not counting the initial try).
|
protected static final int DEFAULT_MAX_PENDING_CONNECTIONS_PER_HOST
protected static final int DEFAULT_UNHEALTHY_CONSECUTIVE_ERROR_COUNT
protected static final long DEFAULT_CLUSTER_UPDATE_INTERVAL_MS
protected static final long DEFAULT_CLUSTER_UPDATE_THRESHOLD_MS
protected static final long DEFAULT_CONNECT_TIMEOUT_MS
protected static final long DEFAULT_REQUEST_TIMEOUT_MS
protected static final long DEFAULT_HEALTH_CHECK_INTERVAL_MS
protected static final long DEFAULT_HEALTH_CHECK_TIMEOUT_MS
protected static final long DEFAULT_IDLE_CONNECTION_TIMEOUT_MS
protected static final int DEFAULT_READ_RETRIES
protected static final int DEFAULT_WRITE_RETRIES
protected static final long DEFAULT_MAX_RETRY_DELAY_MS
protected static final long DEFAULT_THREAD_KEEP_ALIVE_MS
protected static final int DEFAULT_MIN_IDLE_CONNECTION_SIZE
@Deprecated public AWSCredentialsProvider mProvider
@Deprecated public String mRegion
public ClientConfig()
withConnectTimeout(long, TimeUnit)
set to 1000L ms,
withRequestTimeout(long, TimeUnit)
set to 60000L ms,
withHealthCheckInterval(long, TimeUnit)
set to 5000L ms,
withHealthCheckTimeout(long, TimeUnit)
set to 1000L ms,
withIdleConnectionTimeout(long, TimeUnit)
set to 30000L ms,
withMinIdleConnectionSize(int)
set to 1,
withClusterUpdateInterval(long, TimeUnit)
set to 4000L ms,
withClusterUpdateThreshold(long, TimeUnit)
set to 125L ms,
withThreadKeepAlive(long, TimeUnit)
set to 10000L ms,
withMaxPendingConnectsPerHost(int)
set to 10,
withUnhealthyConsecutiveErrorCount(int)
set to 5,
withWriteRetries(int)
set to 2,
withReadRetries(int)
set to 2,
withMaxRetryDelay(long, TimeUnit)
set to 7000L ms
public boolean isEncrypted()
public com.amazon.dax.client.HostPort[] getHostPorts()
withEndpoints(String...)
,
withEndpoints(boolean, String...)
,
setEndpoints(String...)
,
setEndpoints(boolean, String...)
public com.amazon.dax.client.DaxHostnameVerifier getHostVerifier()
public void setEndpoints(String... hosts)
Cluster discovery endpoints are available from the DynamoDB console or by calling describe-clusters with the AWS CLI or DAX control plane client.
hosts
- the cluster discovery endpoints, in the form [scheme://]hostname:portgetHostPorts()
public void setEndpoints(boolean skipHostnameVerification, String... hosts)
Cluster discovery endpoints are available from the DynamoDB console or by calling describe-clusters with the AWS CLI or DAX control plane client. For encrypted cluster, only one cluster discovery endpoint may be provided.
skipHostnameVerification
- skip hostname verification of TLS connections. This parameter has no impact on unecrypted clusters.
The default is to perform hostname verification, setting this to true will skip verification.
Be sure you understand the implication of doing so, which is the inability to authenticate the cluster that you are connecting to.hosts
- the cluster discovery endpoints, in the form [scheme://]hostname:portgetHostPorts()
public ClientConfig withEndpoints(String... hosts)
Cluster discovery endpoints are available from the DynamoDB console or by calling describe-clusters with the AWS CLI or DAX control plane client.
hosts
- the cluster discovery endpoints, in the form [scheme://]hostname:portgetHostPorts()
public ClientConfig withEndpoints(boolean skipHostnameVerification, String... hosts)
Cluster discovery endpoints are available from the DynamoDB console or by calling describe-clusters with the AWS CLI or DAX control plane client. For encrypted cluster, only one cluster discovery endpoint may be provided.
skipHostnameVerification
- skip hostname verification of TLS connections. This parameter has no impact on unecrypted clusters.
The default is to perform hostname verification, setting this to True will skip verification.
Be sure you understand the implication of doing so, which is the inability to authenticate the cluster that you are connecting to.hosts
- the cluster discovery endpoints, in the form [scheme://]hostname:portgetHostPorts()
public long getConnectTimeout()
Defaults to 1000L ms.
public void setConnectTimeout(long connectTimeout, TimeUnit unit)
Defaults to 1000L ms.
connectTimeout
- the timeoutunit
- the time unit for connectTimeoutpublic ClientConfig withConnectTimeout(long connectTimeout, TimeUnit unit)
Defaults to 1000L ms.
connectTimeout
- the timeoutunit
- the time unit for connectTimeoutpublic long getRequestTimeout()
Defaults to 60000L ms.
public void setRequestTimeout(long RequestTimeout, TimeUnit unit)
Defaults to 60000L ms.
RequestTimeout
- the timeoutunit
- the time unit for readTimeoutpublic ClientConfig withRequestTimeout(long RequestTimeout, TimeUnit unit)
Defaults to 60000L ms.
RequestTimeout
- the timeoutunit
- the time unit for readTimeoutpublic long getHealthCheckTimeout()
public void setHealthCheckTimeout(long healthCheckTimeout, TimeUnit unit)
Defaults to 1000L ms.
healthCheckTimeout
- the timeoutunit
- the time unit for healthCheckTimeoutpublic ClientConfig withHealthCheckTimeout(long healthCheckTimeout, TimeUnit unit)
Defaults to 1000L ms.
healthCheckTimeout
- the timeoutunit
- the time unit for healthCheckTimeoutpublic long getHealthCheckInterval()
public void setHealthCheckInterval(long healthCheckInterval, TimeUnit unit)
Defaults to 5000L ms.
healthCheckInterval
- the intervalunit
- the time unit for healthCheckIntervalpublic ClientConfig withHealthCheckInterval(long healthCheckInterval, TimeUnit unit)
Defaults to 5000L ms.
healthCheckInterval
- the intervalunit
- the time unit for healthCheckIntervalpublic long getIdleConnectionTimeout()
public void setIdleConnectionTimeout(long idleTimeout, TimeUnit unit)
Defaults to 30000L ms.
idleTimeout
- the timeoutunit
- the time unit for idleTimeoutpublic ClientConfig withIdleConnectionTimeout(long idleTimeout, TimeUnit unit)
Defaults to 30000L ms.
idleTimeout
- the timeoutunit
- the time unit for idleTimeoutpublic int getMinIdleConnectionSize()
For every request, client will use an idle connection, if available, and establish a new one if none is available.
Idle connections will be closed after the timeout specified in getIdleConnectionTimeout()
.
Note: connections are not pre-allocated at pool create time and the pool will grow to the min idle size on demand.
Defaults to 1 and the min value is 1.
public void setMinIdleConnectionSize(int size)
For every request, client will use an idle connection, if available, and establish a new one if none is available.
Idle connections will be closed after the timeout specified in getIdleConnectionTimeout()
.
Note: connections are not pre-allocated at pool create time and the pool will grow to the min idle size on demand.
Defaults to 1 and the min value is 1.
size
- the minimum sizepublic ClientConfig withMinIdleConnectionSize(int size)
For every request, client will use an idle connection, if available, and establish a new one if none is available.
Idle connections will be closed after the timeout specified in getIdleConnectionTimeout()
.
Note: connections are not pre-allocated at pool create time and the pool will grow to the min idle size on demand.
Defaults to 1 and the min value is 1.
size
- the minimum sizepublic int getWriteRetries()
public void setWriteRetries(int writeRetries)
Defaults to 2.
writeRetries
- the number of times to retrypublic ClientConfig withWriteRetries(int writeRetries)
Defaults to 2.
writeRetries
- the number of times to retrypublic int getMaxPendingConnectsPerHost()
Pending connections are connections which are currently connecting.
Defaults to 10.
public void setMaxPendingConnectsPerHost(int maxPending)
Pending connections are connections which are currently connecting.
Defaults to 10.
maxPending
- the maximum number of pending connectionspublic ClientConfig withMaxPendingConnectsPerHost(int maxPending)
Pending connections are connections which are currently connecting.
Defaults to 10.
maxPending
- the maximum number of pending connectionspublic int getReadRetries()
public void setReadRetries(int readRetries)
Defaults to 2.
readRetries
- the number of times to retrypublic ClientConfig withReadRetries(int readRetries)
Defaults to 2.
readRetries
- the number of times to retrypublic long getThreadKeepAlive()
This is the length of time before idle threads will be terminated. The affected threads are monitoring connections to the DAX cluster. Defaults to 10000L ms.
public void setThreadKeepAlive(long threadKeepAlive, TimeUnit unit)
This is the length of time before idle threads will be terminated. The affected threads are monitoring connections to the DAX cluster. Defaults to 10000L ms.
threadKeepAlive
- the keep alive timeunit
- the time unit for threadKeepAlivepublic ClientConfig withThreadKeepAlive(long threadKeepAlive, TimeUnit unit)
This is the length of time before idle threads will be terminated. The affected threads are monitoring connections to the DAX cluster. Defaults to 10000L ms.
threadKeepAlive
- the keep alive timeunit
- the time unit for threadKeepAlivepublic long getClusterUpdateInterval()
public void setClusterUpdateInterval(long clusterUpdateInterval, TimeUnit unit)
Defaults to 4000L ms.
clusterUpdateInterval
- the interval between pollingunit
- the time unit for clusterUpdateIntervalpublic ClientConfig withClusterUpdateInterval(long clusterUpdateInterval, TimeUnit unit)
Defaults to 4000L ms.
clusterUpdateInterval
- the interval between pollingunit
- the time unit for clusterUpdateIntervalpublic long getClusterUpdateThreshold()
public void setClusterUpdateThreshold(long clusterUpdateThreshold, TimeUnit unit)
Defaults to 125L ms.
clusterUpdateThreshold
- the update thresholdunit
- the time unit for clusterUpdateThresholdpublic ClientConfig withClusterUpdateThreshold(long clusterUpdateThreshold, TimeUnit unit)
Defaults to 125L ms.
clusterUpdateThreshold
- the update thresholdunit
- the time unit for clusterUpdateThresholdpublic AWSCredentialsProvider getCredentialsProvider()
public void setCredentialsProvider(AWSCredentialsProvider provider)
provider
- the credentials providerpublic ClientConfig withCredentialsProvider(AWSCredentialsProvider provider)
provider
- the credentials providerpublic long getMaxRetryDelay()
If the cluster is believed to be healthy this delay is not used; instead a retry is immediately attempted (on another node if the cluster has more than one member). Defaults to 7000L ms.
public void setMaxRetryDelay(long retryDelayCap, TimeUnit unit)
If the cluster is believed to be healthy this delay is not used; instead a retry is immediately attempted (on another node if the cluster has more than one member). Defaults to 7000L ms.
retryDelayCap
- the maximum delayunit
- the time unit for retryDelayCappublic ClientConfig withMaxRetryDelay(long retryDelayCap, TimeUnit unit)
If the cluster is believed to be healthy this delay is not used; instead a retry is immediately attempted (on another node if the cluster has more than one member). Defaults to 7000L ms.
retryDelayCap
- the maximum delayunit
- the time unit for retryDelayCappublic String getRegion()
The region is necessary for signing requests; it is not used for cluster discovery.
public void setRegion(Region region)
The region is necessary for signing requests; it is not used for cluster discovery.
region
- the regionpublic void setRegion(String region)
The region is necessary for signing requests; it is not used for cluster discovery.
region
- the regionpublic ClientConfig withRegion(Region region)
The region is necessary for signing requests; it is not used for cluster discovery.
region
- the regionpublic ClientConfig withRegion(String region)
The region is necessary for signing requests; it is not used for cluster discovery.
region
- the regionpublic int getUnhealthyConsecutiveErrorCount()
Defaults to 5.
public void setUnhealthyConsecutiveErrorCount(int errorCount)
Defaults to 5.
errorCount
- number of errorspublic ClientConfig withUnhealthyConsecutiveErrorCount(int errorCount)
Defaults to 5.
errorCount
- number of errors