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

com.github.edgar615.util.vertx.task.Tuple5TaskImpl Maven / Gradle / Ivy

The newest version!
package com.github.edgar615.util.vertx.task;

import com.github.edgar615.util.vertx.function.Tuple5;
import io.vertx.core.CompositeFuture;
import io.vertx.core.Future;

/**
 * Created by Edgar on 2016/7/21.
 *
 * @author Edgar  Date 2016/7/21
 */
class Tuple5TaskImpl extends BaseTask> implements
        Tuple5Task {

  Tuple5TaskImpl(String name, Future futureT1, Future futureT2, Future futureT3,
                 Future futureT4, Future futureT5) {
    super(name, Future.>future());
    CompositeFuture compositeFuture =
            CompositeFuture.all(futureT1, futureT2, futureT3, futureT4, futureT5);
    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);
        complete(Tuple5.create(t1, t2, t3, t4, t5));
      } else {
        fail(ar.cause());
      }
    });
  }

  Tuple5TaskImpl(Future futureT1, Future futureT2, Future futureT3, Future futureT4,
                 Future futureT5) {
    this("Tuple5Task", futureT1, futureT2, futureT3, futureT4, futureT5);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy