vertx/src/main/java/eu/internetofus/common/vertx/AbstractMainVerticle.java
/**
   * Deploy the next verticle.
   *
   * @param verticlesToDeploy the list of verticles to deploy.
   * @param startPromise      promise to inform when all the verticles has been deployed.
   */
Deploy the next verticle.
@param verticlesToDeploy the list of verticles to deploy.
@param startPromise      promise to inform when all the verticles has been deployed.
Deploy the next verticle . @param verticlesToDeploy the list of verticles to deploy . @param startPromise promise to inform when all the verticles has been deployed .
private void deployNextVerticle(final List<Class<? extends AbstractVerticle>> verticlesToDeploy, final Promise<Void> startPromise) {
    if (verticlesToDeploy.isEmpty()) {
      startPromise.complete();
    } else {
      final Class<? extends AbstractVerticle> verticle = verticlesToDeploy.remove(0);
      try {
        final var conf = this.config();
        final var options = new DeploymentOptions(conf).setConfig(conf);
        if (verticle.isAnnotationPresent(Worker.class)) {
          options.setWorker(true);
        }
        Logger.trace("Deploying verticle {}", verticle);
        this.getVertx().deployVerticle(verticle, options, deploy -> {
          if (deploy.failed()) {
            final var cause = deploy.cause();
            Logger.error(cause, "Cannot deploy verticle {}", verticle);
            startPromise.fail(cause);
          } else {
            Logger.trace("Deployed verticle {}", verticle);
            this.deployNextVerticle(verticlesToDeploy, startPromise);
          }
        });
      } catch (final Throwable t) {
        Logger.error(t, "Cannot deploy verticle {}", verticle);
        startPromise.fail(t);
      }
    }
  }
private void deployNextVerticle ( final List < Class < ? extends AbstractVerticle > > verticlesToDeploy , final Promise < Void > startPromise ) { if ( verticlesToDeploy . isEmpty ( ) ) { startPromise . complete ( ) ; } else { final Class < ? extends AbstractVerticle > verticle = verticlesToDeploy . remove ( 0 ) ; try { final var conf = this . config ( ) ; final var options = new DeploymentOptions ( conf ) . setConfig ( conf ) ; if ( verticle . isAnnotationPresent ( Worker . class ) ) { options . setWorker ( true ) ; } Logger . trace ( "Deploying verticle {}" , verticle ) ; this . getVertx ( ) . deployVerticle ( verticle , options , deploy -> { if ( deploy . failed ( ) ) { final var cause = deploy . cause ( ) ; Logger . error ( cause , "Cannot deploy verticle {}" , verticle ) ; startPromise . fail ( cause ) ; } else { Logger . trace ( "Deployed verticle {}" , verticle ) ; this . deployNextVerticle ( verticlesToDeploy , startPromise ) ; } } ) ; } catch ( final Throwable t ) { Logger . error ( t , "Cannot deploy verticle {}" , verticle ) ; startPromise . fail ( t ) ; } } }
Deploy the next verticle.
Deploy the next verticle .