use of com.continuuity.weave.zookeeper.ZKClient in project weave by continuuity.
the class YarnWeaveRunnerService method prepare.
@Override
public WeavePreparer prepare(WeaveApplication application) {
Preconditions.checkState(isRunning(), "Service not start. Please call start() first.");
final WeaveSpecification weaveSpec = application.configure();
final String appName = weaveSpec.getName();
return new YarnWeavePreparer(yarnConfig, weaveSpec, yarnAppClient, zkClientService, locationFactory, Suppliers.ofInstance(jvmOptions), new YarnWeaveControllerFactory() {
@Override
public YarnWeaveController create(RunId runId, Iterable<LogHandler> logHandlers, Callable<ProcessController<YarnApplicationReport>> startUp) {
ZKClient zkClient = ZKClients.namespace(zkClientService, "/" + appName);
YarnWeaveController controller = listenController(new YarnWeaveController(runId, zkClient, logHandlers, startUp));
synchronized (YarnWeaveRunnerService.this) {
Preconditions.checkArgument(!controllers.contains(appName, runId), "Application %s with runId %s is already running.", appName, runId);
controllers.put(appName, runId, controller);
}
return controller;
}
});
}
Aggregations