io.sphere.sdk.http.CompletableFutureCallbackAdapter Maven / Gradle / Ivy
package io.sphere.sdk.http;
import org.apache.http.concurrent.FutureCallback;
import java.util.concurrent.CompletableFuture;
final class CompletableFutureCallbackAdapter extends Base implements FutureCallback {
private final CompletableFuture future;
public CompletableFutureCallbackAdapter(final CompletableFuture future) {
this.future = future;
}
@Override
public void cancelled() {
future.cancel(true);
}
@Override
public void completed(final T result) {
future.complete(result);
}
@Override
public void failed(final Exception e) {
future.completeExceptionally(e);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy