use of software.amazon.awssdk.http.SdkCancellationException in project aws-sdk-java-v2 by aws.
the class CrtRequestExecutor method createExecutionFuture.
/**
* Convenience method to create the execution future and set up the cancellation logic.
*
* @return The created execution future.
*/
private CompletableFuture<Void> createExecutionFuture(AsyncExecuteRequest request) {
CompletableFuture<Void> future = new CompletableFuture<>();
future.whenComplete((r, t) -> {
if (t == null) {
return;
}
// TODO: Aborting request once it's supported in CRT
if (future.isCancelled()) {
request.responseHandler().onError(new SdkCancellationException("The request was cancelled"));
}
});
return future;
}
Aggregations