public final class TimeoutExceptionHandlingStage<OutputT> extends Object implements RequestToResponsePipeline<OutputT>
Exception
is caused by either ApiCallTimeout or ApiAttemptTimeout and translate that
exception to a more appropriate timeout related exception so that it can be handled in other stages.Constructor and Description |
---|
TimeoutExceptionHandlingStage(HttpClientDependencies dependencies,
RequestPipeline<SdkHttpFullRequest,Response<OutputT>> requestPipeline) |
Modifier and Type | Method and Description |
---|---|
Response<OutputT> |
execute(SdkHttpFullRequest request,
RequestExecutionContext context)
Translate an
Exception caused by timeout based on the following criteria:
If the Exception is caused by ClientOverrideConfiguration.apiCallTimeout , translates it to
InterruptedException so it can be handled
appropriately in ApiCallTimeoutTrackingStage . |
public TimeoutExceptionHandlingStage(HttpClientDependencies dependencies, RequestPipeline<SdkHttpFullRequest,Response<OutputT>> requestPipeline)
public Response<OutputT> execute(SdkHttpFullRequest request, RequestExecutionContext context) throws Exception
Exception
caused by timeout based on the following criteria:
Exception
is caused by ClientOverrideConfiguration.apiCallTimeout
, translates it to
InterruptedException
so it can be handled
appropriately in ApiCallTimeoutTrackingStage
. ClientOverrideConfiguration.apiCallAttemptTimeout()
, clear the interrupt status,
translates it to ApiCallAttemptTimeoutException
so that it might be retried
in RetryableStage
ApiCallTimeout takes precedence because it is not retryable.
execute
in interface RequestPipeline<SdkHttpFullRequest,Response<OutputT>>
request
- the requestcontext
- Context containing both request dependencies, and a container for any mutable state that must be shared
between stages.Exception
- the translated exception or the original exceptionCopyright © 2020. All rights reserved.