@Override public void deployModule(String moduleName, Handler<AsyncResult<String>> doneHandler) { mgr.deployModule(moduleName, null, 1, doneHandler); }
@Override public void deployVerticle(String main, JsonObject config, int instances, Handler<AsyncResult<String>> doneHandler) { mgr.deployVerticle(main, config, null, instances, null, doneHandler); }
@Override public void deployWorkerVerticle(String main, JsonObject config, int instances, boolean multiThreaded, Handler<AsyncResult<String>> doneHandler) { mgr.deployWorkerVerticle(multiThreaded, main, config, null, instances, null, doneHandler); }
platformManager.deployWorkerVerticle(false, main, config, new URL[]{}, instances, null, doneHandler); } else { platformManager.deployVerticle(main, config, new URL[]{}, instances, null, doneHandler);
protected void stopApp(String appName, boolean wait) throws Exception { //EventLog.addEvent("Stopping app " + appName); final CountDownLatch latch = new CountDownLatch(1); Integer instances = platformManager.listInstances().get(appName); final AtomicReference<Boolean> failed = new AtomicReference<>(false); platformManager.undeploy(appName, new AsyncResultHandler<Void>() { public void handle(AsyncResult<Void> res) { if (res.failed()) { log.error("Failed to undeploy", res.cause()); failed.set(true); } latch.countDown(); } }); if (!latch.await(30, TimeUnit.SECONDS)) { EventLog.dump(); throw new IllegalStateException("Timedout waiting for app to stop"); } if (failed.get()) { fail("Failed to undeploy"); } //EventLog.addEvent("App is undeployed"); if (wait) { for (int i = 0; i < instances; i++) { waitAppStopped(); } } EventLog.addEvent("Waited for app to stop"); startedApps.remove(appName); }
private void undeployHADeployments() { for (final Map.Entry<String, Deployment> entry: platformManager.deployments().entrySet()) { if (entry.getValue().ha) { DefaultContext ctx = vertx.getContext(); try { vertx.setContext(null); platformManager.undeploy(entry.getKey(), new AsyncResultHandler<Void>() { @Override public void handle(AsyncResult<Void> result) {
@Override public void undeployVerticle(String deploymentID, Handler<AsyncResult<Void>> doneHandler) { mgr.undeploy(deploymentID, doneHandler); }
@Override public JsonObject config() { return mgr.config(); }
@Override public void exit() { mgr.exit(); }
public void deployModule(final String moduleName, final JsonObject config, final int instances, final Handler<AsyncResult<String>> doneHandler) { if (attainedQuorum) { final Handler<AsyncResult<String>> wrappedHandler = new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> asyncResult) { if (asyncResult.succeeded()) { // Tell the other nodes of the cluster about the module for HA purposes addToHA(asyncResult.result(), moduleName, config, instances); } if (doneHandler != null) { doneHandler.handle(asyncResult); } else if (asyncResult.failed()) { log.error("Failed to deploy module", asyncResult.cause()); } } }; platformManager.deployModuleInternal(moduleName, config, instances, true, wrappedHandler); } else { log.info("Quorum not attained. Deployment of module will be delayed until there's a quorum."); addToHADeployList(moduleName, config, instances, doneHandler); } }
@Override protected void tearDown() throws Exception { try { throwAsserts(); } finally { try { List<String> apps = new ArrayList<>(startedApps); for (String appName: apps) { stopApp(appName); } events.clear(); vertx.eventBus().unregisterHandler(EVENTS_ADDRESS, handler); } catch (Exception e) { e.printStackTrace(); throw e; } } if (platformManager.checkNoModules() > 0) { fail("Module references remain after test"); } EventLog.addEvent("teardown complete"); EventLog.clear(); }
@Override public void undeployModule(String deploymentID, Handler<AsyncResult<Void>> doneHandler) { mgr.undeploy(deploymentID, doneHandler); }
@Override public void deployModule(String moduleName, JsonObject config, Handler<AsyncResult<String>> doneHandler) { mgr.deployModule(moduleName, config, 1, doneHandler); }
@Override public void deployModule(String moduleName, int instances, Handler<AsyncResult<String>> doneHandler) { mgr.deployModule(moduleName, null, instances, doneHandler); }
@Override public void deployModule(String moduleName, JsonObject config, int instances, Handler<AsyncResult<String>> doneHandler) { mgr.deployModule(moduleName, config, instances, doneHandler); }
public String startMod(String modName, JsonObject config, int instances, boolean await) throws Exception { final CountDownLatch doneLatch = new CountDownLatch(1); final AtomicReference<String> res = new AtomicReference<>(null); AsyncResultHandler<String> doneHandler = new AsyncResultHandler<String>() { public void handle(AsyncResult<String> fr) { if (fr.succeeded()) { String deploymentName = fr.result(); startedApps.add(deploymentName); res.set(deploymentName); } else { log.error("Failed to start module", fr.cause()); } doneLatch.countDown(); } }; platformManager.deployModule(modName, config, instances, doneHandler); if (!doneLatch.await(30, TimeUnit.SECONDS)) { throw new IllegalStateException("Timedout waiting for apps to start"); } String deployID = res.get(); if (deployID != null && await) { for (int i = 0; i < instances; i++) { waitAppReady(); } } return deployID; }
platformManager.deployModule(moduleName, failedModule.getObject("conf"), failedModule.getInteger("instances"), true, new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) {