com.github.edgar615.util.vertx.task.BaseTask Maven / Gradle / Ivy
The newest version!
package com.github.edgar615.util.vertx.task;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
/**
* Created by Edgar on 2016/5/9.
*
* @author Edgar Date 2016/5/9
*/
class BaseTask implements Task {
/**
* future
*/
private final Future future;
private String name;
BaseTask(String name, Future future) {
this.name = name;
this.future = future;
}
BaseTask(Future future) {
this("createTask:", future);
}
@Override
public String name() {
return this.name;
}
@Override
public void complete(T result) {
future.complete(result);
}
@Override
public void fail(Throwable throwable) {
future.fail(throwable);
}
@Override
public T result() {
return future.result();
}
public Throwable cause() {
return future.cause();
}
public boolean succeeded() {
return future.succeeded();
}
public boolean failed() {
return future.failed();
}
@Override
public boolean isComplete() {
return future.isComplete();
}
@Override
public void setHandler(Handler> handler) {
future.setHandler(handler);
}
@Override
public Handler> completer() {
return future.completer();
}
}