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

com.commercetools.http.apachehttp.CompletableFutureCallbackAdapter Maven / Gradle / Ivy

The newest version!

package com.commercetools.http.apachehttp;

import java.util.concurrent.CompletableFuture;

import org.apache.hc.core5.concurrent.FutureCallback;

final class CompletableFutureCallbackAdapter 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