Class TimeoutExceptionHandlingStage<OutputT>
java.lang.Object
software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage<OutputT>
- All Implemented Interfaces:
RequestPipeline<SdkHttpFullRequest,
,Response<OutputT>> RequestToResponsePipeline<OutputT>
public final class TimeoutExceptionHandlingStage<OutputT>
extends Object
implements RequestToResponsePipeline<OutputT>
Check if an
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 Summary
ConstructorDescriptionTimeoutExceptionHandlingStage
(HttpClientDependencies dependencies, RequestPipeline<SdkHttpFullRequest, Response<OutputT>> requestPipeline) -
Method Summary
Modifier and TypeMethodDescriptionexecute
(SdkHttpFullRequest request, RequestExecutionContext context) Translate anException
caused by timeout based on the following criteria: If theException
is caused byClientOverrideConfiguration.apiCallTimeout()
, translates it toInterruptedException
so it can be handled appropriately inApiCallTimeoutTrackingStage
.
-
Constructor Details
-
TimeoutExceptionHandlingStage
public TimeoutExceptionHandlingStage(HttpClientDependencies dependencies, RequestPipeline<SdkHttpFullRequest, Response<OutputT>> requestPipeline)
-
-
Method Details
-
execute
public Response<OutputT> execute(SdkHttpFullRequest request, RequestExecutionContext context) throws Exception Translate anException
caused by timeout based on the following criteria:- If the
Exception
is caused byClientOverrideConfiguration.apiCallTimeout()
, translates it toInterruptedException
so it can be handled appropriately inApiCallTimeoutTrackingStage
. -
If it is caused by
ClientOverrideConfiguration.apiCallAttemptTimeout()
, clear the interrupt status, translates it toApiCallAttemptTimeoutException
so that it might be retried inRetryableStage
ApiCallTimeout takes precedence because it is not retryable.
- Specified by:
execute
in interfaceRequestPipeline<SdkHttpFullRequest,
Response<OutputT>> - Parameters:
request
- the requestcontext
- Context containing both request dependencies, and a container for any mutable state that must be shared between stages.- Returns:
- the response
- Throws:
Exception
- the translated exception or the original exception
- If the
-