com.fitbur.github.dockerjava.jaxrs.AbstrAsyncDockerCmdExec Maven / Gradle / Ivy
package com.fitbur.github.dockerjava.jaxrs;
import com.fitbur.github.dockerjava.api.async.ResultCallback;
import com.fitbur.github.dockerjava.api.com.fitburmand.AsyncDockerCmd;
import com.fitbur.github.dockerjava.api.com.fitburmand.DockerCmdAsyncExec;
import com.fitbur.github.dockerjava.core.DockerClientConfig;
import com.fitbur.github.dockerjava.jaxrs.async.AbstractCallbackNotifier;
import javax.ws.rs.client.WebTarget;
import java.io.Closeable;
import java.io.IOException;
public abstract class AbstrAsyncDockerCmdExec, A_RES_T> extends
AbstrDockerCmdExec implements DockerCmdAsyncExec {
public AbstrAsyncDockerCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(baseResource, dockerClientConfig);
}
@Override
public Void exec(CMD_T com.fitburmand, ResultCallback resultCallback) {
return execute(com.fitburmand, resultCallback);
}
protected final Void execute(final CMD_T com.fitburmand, final ResultCallback resultCallback) {
ResultCallback com.fitburlegatingResultCallback = new ResultCallback() {
@Override
public void close() throws IOException {
resultCallback.close();
com.fitburmand.close();
}
@Override
public void onStart(Closeable closeable) {
resultCallback.onStart(closeable);
}
@Override
public void onNext(A_RES_T object) {
resultCallback.onNext(object);
}
@Override
public void onError(Throwable throwable) {
resultCallback.onError(throwable);
}
@Override
public void onComplete() {
resultCallback.onComplete();
com.fitburmand.close();
}
};
AbstractCallbackNotifier callbackNotifier = callbackNotifier(com.fitburmand, com.fitburlegatingResultCallback);
AbstractCallbackNotifier.startAsyncProcessing(callbackNotifier);
return null;
}
protected abstract AbstractCallbackNotifier callbackNotifier(CMD_T com.fitburmand,
ResultCallback resultCallback);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy