
io.sphere.sdk.http.ResponseAsyncCompletionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-http-ahc-2_5 Show documentation
Show all versions of sdk-http-ahc-2_5 Show documentation
This SDK is announced to be deprecated latest by 31 December 2022, please follow more details on SDK deprecation plan https://docs.commercetools.com/api/releases/2021-08-31-announced-long-term-support-plan-for-commercetools-sdks. We recommend you to use our new SDK here https://docs.commercetools.com/sdk/jvm-sdk#java-sdk-v2.
The newest version!
package io.sphere.sdk.http;
import org.asynchttpclient.AsyncCompletionHandler;
import org.asynchttpclient.Response;
import java.util.concurrent.CompletableFuture;
final class ResponseAsyncCompletionHandler extends AsyncCompletionHandler {
private final CompletableFuture future;
ResponseAsyncCompletionHandler(final CompletableFuture future) {
this.future = future;
}
@Override
public Response onCompleted(final Response response) throws Exception {
future.complete(response);
return response;
}
@Override
public void onThrowable(final Throwable t) {
future.completeExceptionally(t);
super.onThrowable(t);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy