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

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

There is a newer version: 1.0.14
Show newest version
package com.github.edgar615.util.vertx.task;

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

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

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

  Tuple4TaskImpl(Future futureT1, Future futureT2, Future futureT3,
                 Future futureT4) {
    this("Tuple4Task", futureT1, futureT2, futureT3, futureT4);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy