public final class ConnectionPolicy extends Object
Constructor and Description |
---|
ConnectionPolicy()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ConnectionMode |
getConnectionMode()
Gets the connection mode used in the client.
|
static ConnectionPolicy |
GetDefault()
Gets the default connection policy.
|
boolean |
getEnableEndpointDiscovery()
Gets the flag to enable endpoint discovery for geo-replicated database accounts.
|
int |
getIdleConnectionTimeoutInMillis()
Gets the value of the timeout for an idle connection, the default is 60
seconds.
|
int |
getMaxPoolSize()
Gets the value of the connection pool size the client is using.
|
MediaReadMode |
getMediaReadMode()
Gets the attachment content (aka media) download mode.
|
int |
getMediaRequestTimeoutInMillis()
Gets or sets time to wait for response from network peer for attachment
content (aka media) operations.
|
Collection<String> |
getPreferredLocations()
Gets the preferred locations for geo-replicated database accounts
|
int |
getRequestTimeoutInMillis()
Gets the request timeout (time to wait for response from network peer) in
milliseconds.
|
RetryOptions |
getRetryOptions()
Gets the retry policy options associated with the DocumentClient instance.
|
String |
getUserAgentSuffix()
Gets the value of user-agent suffix.
|
void |
setConnectionMode(ConnectionMode connectionMode)
Sets the connection mode used in the client.
|
void |
setEnableEndpointDiscovery(boolean enableEndpointDiscovery)
Sets the flag to enable endpoint discovery for geo-replicated database accounts.
|
void |
setIdleConnectionTimeoutInMillis(int idleConnectionTimeoutInMillis)
sets the value of the timeout for an idle connection.
|
void |
setMaxPoolSize(int maxPoolSize)
Sets the value of the connection pool size, the default
is 1000.
|
void |
setMediaReadMode(MediaReadMode mediaReadMode)
Sets the attachment content (aka media) download mode.
|
void |
setMediaRequestTimeoutInMillis(int mediaRequestTimeoutInMillis)
Gets or sets Time to wait for response from network peer for attachment
content (aka media) operations.
|
void |
setPreferredLocations(Collection<String> preferredLocations)
Sets the preferred locations for geo-replicated database accounts.
|
void |
setRequestTimeoutInMillis(int requestTimeoutInMillis)
Sets the request timeout (time to wait for response from network peer) in
milliseconds.
|
void |
setRetryOptions(RetryOptions retryOptions)
Sets the retry policy options associated with the DocumentClient instance.
|
void |
setUserAgentSuffix(String userAgentSuffix)
sets the value of the user-agent suffix.
|
String |
toString() |
public static ConnectionPolicy GetDefault()
public int getRequestTimeoutInMillis()
public void setRequestTimeoutInMillis(int requestTimeoutInMillis)
requestTimeoutInMillis
- the request timeout in milliseconds.public int getMediaRequestTimeoutInMillis()
public void setMediaRequestTimeoutInMillis(int mediaRequestTimeoutInMillis)
mediaRequestTimeoutInMillis
- the media request timeout in milliseconds.public ConnectionMode getConnectionMode()
public void setConnectionMode(ConnectionMode connectionMode)
connectionMode
- the connection mode.public MediaReadMode getMediaReadMode()
public void setMediaReadMode(MediaReadMode mediaReadMode)
mediaReadMode
- the media read mode.public int getMaxPoolSize()
public void setMaxPoolSize(int maxPoolSize)
maxPoolSize
- The value of the connection pool size.public int getIdleConnectionTimeoutInMillis()
public void setIdleConnectionTimeoutInMillis(int idleConnectionTimeoutInMillis)
idleConnectionTimeoutInMillis
- the timeout for an idle connection in seconds.public String getUserAgentSuffix()
public void setUserAgentSuffix(String userAgentSuffix)
userAgentSuffix
- The value to be appended to the user-agent header, this is
used for monitoring purposes.public RetryOptions getRetryOptions()
public void setRetryOptions(RetryOptions retryOptions)
Properties in the RetryOptions class allow application to customize the built-in retry policies. This property is optional. When it's not set, the SDK uses the default values for configuring the retry policies. See RetryOptions class for more details.
retryOptions
- the RetryOptions instance.public boolean getEnableEndpointDiscovery()
public void setEnableEndpointDiscovery(boolean enableEndpointDiscovery)
When EnableEndpointDiscovery is true, the SDK will automatically discover the current write and read regions to ensure requests are sent to the correct region based on the capability of the region and the user's preference.
The default value for this property is true indicating endpoint discovery is enabled.
enableEndpointDiscovery
- true if EndpointDiscovery is enabled.public Collection<String> getPreferredLocations()
public void setPreferredLocations(Collection<String> preferredLocations)
When EnableEndpointDiscovery is true and PreferredRegions is non-empty, the SDK will prefer to use the locations in the collection in the order they are specified to perform operations.
If EnableEndpointDiscovery is set to false, this property is ignored.
preferredLocations
- the list of preferred locations.Copyright © 2018. All rights reserved.