com.github.edgar615.util.vertx.task.Tuple6TaskImpl Maven / Gradle / Ivy
The newest version!
package com.github.edgar615.util.vertx.task;
import com.github.edgar615.util.vertx.function.Tuple6;
import io.vertx.core.CompositeFuture;
import io.vertx.core.Future;
/**
* Created by Edgar on 2016/7/21.
*
* @author Edgar Date 2016/7/21
*/
class Tuple6TaskImpl extends BaseTask>
implements Tuple6Task {
Tuple6TaskImpl(String name, Future futureT1, Future futureT2, Future futureT3,
Future futureT4, Future futureT5, Future futureT6) {
super(name, Future.>future());
CompositeFuture compositeFuture =
CompositeFuture.all(futureT1, futureT2, futureT3, futureT4, futureT5, futureT6);
compositeFuture.setHandler(ar -> {
if (ar.succeeded()) {
T1 t1 = ar.result().resultAt(0);
T2 t2 = ar.result().resultAt(1);
T3 t3 = ar.result().resultAt(2);
T4 t4 = ar.result().resultAt(3);
T5 t5 = ar.result().resultAt(4);
T6 t6 = ar.result().resultAt(5);
complete(Tuple6.create(t1, t2, t3, t4, t5, t6));
} else {
fail(ar.cause());
}
});
}
Tuple6TaskImpl(Future futureT1, Future futureT2, Future futureT3, Future futureT4,
Future futureT5, Future futureT6) {
this("Tuple6Task", futureT1, futureT2, futureT3, futureT4, futureT5, futureT6);
}
}