All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.http.CompletableFutureCallbackAdapter Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
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