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()) {
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);
}
}