use of com.sequenceiq.cloudbreak.controller.FlowsAlreadyRunningException in project cloudbreak by hortonworks.
the class ReactorFlowManager method notify.
private void notify(String selector, Acceptable acceptable) {
Event<Acceptable> event = eventFactory.createEventWithErrHandler(acceptable);
reactor.notify(selector, event);
try {
Boolean accepted = true;
if (event.getData().accepted() != null) {
accepted = event.getData().accepted().await(WAIT_FOR_ACCEPT, TimeUnit.SECONDS);
}
if (accepted == null || !accepted) {
Stack stack = stackService.get(event.getData().getStackId());
throw new FlowsAlreadyRunningException(String.format("Stack %s has flows under operation, request not allowed.", stack.getName()));
}
} catch (InterruptedException e) {
throw new CloudbreakApiException(e.getMessage());
}
}
use of com.sequenceiq.cloudbreak.controller.FlowsAlreadyRunningException in project cloudbreak by hortonworks.
the class CloudbreakCleanupService method triggerSyncs.
private void triggerSyncs(Iterable<Stack> stacksToSync, Iterable<Cluster> clustersToSync) {
try {
for (Stack stack : stacksToSync) {
LOGGER.info("Triggering full sync on stack [name: {}, id: {}].", stack.getName(), stack.getId());
fireEvent(stack);
flowManager.triggerFullSync(stack.getId());
}
for (Cluster cluster : clustersToSync) {
Stack stack = cluster.getStack();
LOGGER.info("Triggering sync on cluster [name: {}, id: {}].", cluster.getName(), cluster.getId());
fireEvent(stack);
flowManager.triggerClusterSync(stack.getId());
}
} catch (OptimisticLockingFailureException | FlowsAlreadyRunningException e) {
LOGGER.error("Cannot trigger sync on stacks. Maybe another node is already syncing them?", e);
}
}
Aggregations