use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.restart.ClusterServicesRestartResult in project cloudbreak by hortonworks.
the class ClusterServicesRestartHandler method accept.
@Override
public void accept(Event<ClusterServicesRestartRequest> event) {
ClusterServicesRestartRequest request = event.getData();
ClusterServicesRestartResult result;
int requestId;
try {
Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
Optional<Stack> datalakeStack = datalakeService.getDatalakeStackByDatahubStack(stack);
CmTemplateProcessor blueprintProcessor = getCmTemplateProcessor(stack.getCluster());
if (datalakeStack.isPresent() && clusterServicesRestartService.isRDCRefreshNeeded(stack, datalakeStack.get())) {
LOGGER.info("Deploying client config and restarting services");
requestId = clusterServicesRestartService.refreshClusterOnRestart(stack, datalakeStack.get(), blueprintProcessor);
} else {
LOGGER.info("Restarting services");
requestId = apiConnectors.getConnector(stack).clusterModificationService().restartClusterServices();
}
result = new ClusterServicesRestartResult(request, requestId);
} catch (Exception e) {
result = new ClusterServicesRestartResult(e.getMessage(), e, request);
}
eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Aggregations