private void redeploy(final Deployment deployment) {
   // Has to occur on a worker thread
   AsyncResultHandler<String> handler =
       new AsyncResultHandler<String>() {
         public void handle(AsyncResult<String> res) {
           if (!res.succeeded()) {
             log.error("Failed to redeploy", res.exception);
           }
         }
       };
   BlockingAction<Void> redeployAction =
       new BlockingAction<Void>(vertx, handler) {
         @Override
         public Void action() throws Exception {
           doDeployMod(
               true,
               deployment.name,
               deployment.modID,
               deployment.config,
               deployment.instances,
               null,
               null);
           return null;
         }
       };
   redeployAction.run();
 }
  public void deployModule(
      final String moduleName,
      final JsonObject config,
      final int instances,
      final Handler<String> doneHandler) {
    final ModuleIdentifier modID = new ModuleIdentifier(moduleName);
    final File currentModDir = getDeploymentModDir();
    BlockingAction<Void> deployModuleAction =
        new BlockingAction<Void>(vertx, createHandler(doneHandler)) {

          @Override
          public Void action() throws Exception {
            doDeployMod(
                false, null, modID, config, instances, currentModDir, wrapDoneHandler(doneHandler));
            return null;
          }
        };
    deployModuleAction.run();
  }
  public void installModule(final String moduleName) {
    final CountDownLatch latch = new CountDownLatch(1);
    final AtomicReference<Exception> result = new AtomicReference<>();
    final ModuleIdentifier modID = new ModuleIdentifier(moduleName);
    AsyncResultHandler<Void> handler =
        new AsyncResultHandler<Void>() {
          public void handle(AsyncResult<Void> res) {
            result.set(res.exception);
            latch.countDown();
          }
        };

    BlockingAction<Void> installModuleAction =
        new BlockingAction<Void>(vertx, handler) {
          @Override
          public Void action() throws Exception {
            doInstallMod(modID);
            return null;
          }
        };

    installModuleAction.run();

    while (true) {
      try {
        if (!latch.await(300, TimeUnit.SECONDS)) {
          throw new IllegalStateException("Timed out waiting to install module");
        }
        break;
      } catch (InterruptedException ignore) {
      }
    }
    Exception e = result.get();
    if (e != null) {
      log.error("Failed to install module", e);
    }
  }
 private void deployVerticle(
     final boolean worker,
     final boolean multiThreaded,
     final String main,
     final JsonObject config,
     URL[] classpath,
     final int instances,
     final String includes,
     final Handler<String> doneHandler) {
   final File currentModDir = getDeploymentModDir();
   final URL[] cp;
   if (classpath == null) {
     // Use the current moduleRefs/verticle's classpath
     cp = getDeploymentURLs();
   } else {
     cp = classpath;
   }
   BlockingAction<Void> deployModuleAction =
       new BlockingAction<Void>(vertx, createHandler(doneHandler)) {
         @Override
         public Void action() throws Exception {
           doDeployVerticle(
               worker,
               multiThreaded,
               main,
               config,
               cp,
               instances,
               currentModDir,
               includes,
               wrapDoneHandler(doneHandler));
           return null;
         }
       };
   deployModuleAction.run();
 }