use of org.folio.okapi.util.CompList in project okapi by folio-org.
the class DiscoveryManager method autoDeploy2.
private void autoDeploy2(ModuleDescriptor md, ProxyContext pc, Collection<String> allNodes, List<DeploymentDescriptor> ddList, Handler<ExtendedAsyncResult<Void>> fut) {
LaunchDescriptor modLaunchDesc = md.getLaunchDescriptor();
CompList<List<Void>> futures = new CompList<>(USER);
// deploy on all nodes for now
for (String node : allNodes) {
// check if we have deploy on node
logger.info("autoDeploy " + md.getId() + " consider " + node);
DeploymentDescriptor foundDd = null;
for (DeploymentDescriptor dd : ddList) {
if (dd.getNodeId() == null || node.equals(dd.getNodeId())) {
foundDd = dd;
}
}
if (foundDd == null) {
logger.info("autoDeploy " + md.getId() + " must deploy on node " + node);
DeploymentDescriptor dd = new DeploymentDescriptor();
dd.setDescriptor(modLaunchDesc);
dd.setSrvcId(md.getId());
dd.setNodeId(node);
Future<DeploymentDescriptor> f = Future.future();
addAndDeploy(dd, pc, f::handle);
futures.add(f);
} else {
logger.info("autoDeploy " + md.getId() + " already deployed on " + node);
}
}
futures.all(fut);
}
use of org.folio.okapi.util.CompList in project okapi by folio-org.
the class DiscoveryManager method autoUndeploy.
public void autoUndeploy(ModuleDescriptor md, ProxyContext pc, Handler<ExtendedAsyncResult<Void>> fut) {
logger.info("autoUndeploy " + md.getId());
if (md.getId().startsWith(XOkapiHeaders.OKAPI_MODULE)) {
fut.handle(new Success<>());
return;
}
deployments.get(md.getId(), res -> {
if (res.failed()) {
fut.handle(new Failure<>(res.getType(), res.cause()));
} else {
List<DeploymentDescriptor> ddList = res.result();
CompList<List<Void>> futures = new CompList<>(USER);
for (DeploymentDescriptor dd : ddList) {
if (dd.getNodeId() != null) {
Future<Void> f = Future.future();
callUndeploy(dd, pc, f::handle);
futures.add(f);
}
}
futures.all(fut);
}
});
}
use of org.folio.okapi.util.CompList in project okapi by folio-org.
the class EnvManager method init.
public void init(Vertx vertx, Handler<ExtendedAsyncResult<Void>> fut) {
logger.debug("starting EnvManager");
envMap.init(vertx, "env", res -> {
if (res.failed()) {
fut.handle(new Failure<>(res.getType(), res.cause()));
} else {
envStore.getAll(res2 -> {
if (res2.failed()) {
fut.handle(new Failure<>(res2.getType(), res2.cause()));
} else {
CompList<List<Void>> futures = new CompList<>(INTERNAL);
for (EnvEntry e : res2.result()) {
Future<Void> f = Future.future();
add1(e, f::handle);
futures.add(f);
}
futures.all(fut);
}
});
}
});
}
use of org.folio.okapi.util.CompList in project okapi by folio-org.
the class DiscoveryManager method healthList.
private void healthList(List<DeploymentDescriptor> list, Handler<ExtendedAsyncResult<List<HealthDescriptor>>> fut) {
List<HealthDescriptor> all = new LinkedList<>();
CompList<List<HealthDescriptor>> futures = new CompList<>(INTERNAL);
for (DeploymentDescriptor md : list) {
Future<HealthDescriptor> f = Future.future();
health(md, res -> {
if (res.succeeded()) {
all.add(res.result());
}
f.handle(res);
});
futures.add(f);
}
futures.all(all, fut);
}
use of org.folio.okapi.util.CompList in project okapi by folio-org.
the class DiscoveryManager method restartModules.
public void restartModules(Handler<ExtendedAsyncResult<Void>> fut) {
deploymentStore.getAll(res1 -> {
if (res1.failed()) {
fut.handle(new Failure<>(res1.getType(), res1.cause()));
} else {
CompList<List<Void>> futures = new CompList<>(INTERNAL);
for (DeploymentDescriptor dd : res1.result()) {
Future<DeploymentDescriptor> f = Future.future();
addAndDeploy1(dd, null, f::handle);
futures.add(f);
}
futures.all(fut);
}
});
}
Aggregations