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

com.github.threadcontext.httpasyncclient.ContextFutureCallback Maven / Gradle / Ivy

package com.github.threadcontext.httpasyncclient;

import com.github.threadcontext.Context;
import org.apache.http.concurrent.FutureCallback;

public class ContextFutureCallback implements FutureCallback {

    private final FutureCallback delegate;
    private final Context context;

    public ContextFutureCallback(FutureCallback delegate, Context context) {
        this.delegate = delegate;
        this.context = context;
    }

    public void completed(T result) {
        context.run(() -> delegate.completed(result));
    }

    public void failed(Exception ex) {
        context.run(() -> delegate.failed(ex));
    }

    public void cancelled() {
        context.run(delegate::cancelled);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy