use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.AmbariStopServerAndAgentRequest in project cloudbreak by hortonworks.
the class AmbariStopServerAndAgentHandler method accept.
@Override
public void accept(Event<AmbariStopServerAndAgentRequest> event) {
AmbariStopServerAndAgentRequest request = event.getData();
Long stackId = request.getResourceId();
AmbariStopServerAndAgentResult result;
try {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
Set<Node> allNodes = stackUtil.collectNodes(stack);
hostOrchestrator.stopClusterManagerOnMaster(primaryGatewayConfig, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
result = new AmbariStopServerAndAgentResult(request);
} catch (Exception e) {
String message = "Failed to start ambari agent and/or server on new host.";
LOGGER.error(message, e);
result = new AmbariStopServerAndAgentResult(message, e, request);
}
eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Aggregations