connectionPolicy.getIdleConnectionTimeout())); RetryOptions retryOptions = new RetryOptions(); retryOptions.setMaxRetryAttemptsOnThrottledRequests(this.getIntProperty( "azurecosmos.maxRetryAttemptsOnThrottledRequests", retryOptions.getMaxRetryAttemptsOnThrottledRequests())); retryOptions.setMaxRetryWaitTimeInSeconds(this.getIntProperty( "azurecosmos.maxRetryWaitTimeInSeconds", retryOptions.getMaxRetryWaitTimeInSeconds())); connectionPolicy.setRetryOptions(retryOptions); connectionPolicy.getConnectionMode(), consistencyLevel.toString(), connectionPolicy.getRetryOptions().getMaxRetryAttemptsOnThrottledRequests(), connectionPolicy.getRetryOptions().getMaxRetryWaitTimeInSeconds(), this.useSinglePartitionCollection, this.useUpsert,
public ExecuteDocumentClientRequestRetryHandler(RxDocumentServiceRequest request, EndpointManager globalEndpointManager, AsyncDocumentClient client) { this.discoveryRetryPolicy = RetryPolicyBridgeInternal.createEndpointDiscoveryRetryPolicy( client.getConnectionPolicy(), globalEndpointManager); this.throttleRetryPolicy = RetryPolicyBridgeInternal.createResourceThrottleRetryPolicy( client.getConnectionPolicy().getRetryOptions().getMaxRetryAttemptsOnThrottledRequests(), client.getConnectionPolicy().getRetryOptions().getMaxRetryWaitTimeInSeconds()); this.sessionReadRetryPolicy = RetryPolicyBridgeInternal.createSessionReadRetryPolicy( globalEndpointManager, request); }
/** * Gets the maximum number of retries in the case where the request fails * due to a throttle error. * <p> * This property is deprecated. Please use * connectionPolicy.getRetryOptions().getMaxRetryAttemptsOnThrottledRequests() for equivalent * functionality. * * @return maximum number of retry attempts. */ @Deprecated public Integer getMaxRetryOnThrottledAttempts() { return this.retryOptions.getMaxRetryAttemptsOnThrottledRequests(); }
/** * Constructor. */ public ConnectionPolicy() { this.requestTimeout = ConnectionPolicy.DEFAULT_REQUEST_TIMEOUT; this.mediaRequestTimeout = ConnectionPolicy.DEFAULT_MEDIA_REQUEST_TIMEOUT; this.connectionMode = ConnectionMode.Gateway; this.mediaReadMode = MediaReadMode.Buffered; this.maxPoolSize = DEFAULT_MAX_POOL_SIZE; this.idleConnectionTimeout = DEFAULT_IDLE_CONNECTION_TIMEOUT; this.userAgentSuffix = ""; this.retryOptions = new RetryOptions(); }
/** * Sets the maximum number of retries in the case where the request fails * due to a throttle error. * <p> * When a client is sending request faster than the request rate limit imposed by the service, * the service will return HttpStatusCode 429 (Too Many Request) to throttle the client. The current * implementation in the SDK will then wait for the amount of time the service tells it to wait and * retry after the time has elapsed. * <p> * The default value is 9. This means in the case where the request is throttled, * the same request will be issued for a maximum of 10 times to the server before * an error is returned to the application. * <p> * This property is deprecated. Please use * connectionPolicy.getRetryOptions().setMaxRetryAttemptsOnThrottledRequests() for equivalent * functionality. * * @param maxRetryOnThrottledAttempts the max number of retry attempts on failed requests. */ @Deprecated public void setMaxRetryOnThrottledAttempts(Integer maxRetryOnThrottledAttempts) { int maxAttempts = 0; if (maxRetryOnThrottledAttempts != null) { maxAttempts = maxRetryOnThrottledAttempts; } this.retryOptions.setMaxRetryAttemptsOnThrottledRequests(maxAttempts); }