if (pollingAttempt >= MAX_POLLING_ATTEMPTS) {
throw new AmbariHostsUnavailableException(String.format("Operation timed out. Failed to start Ambari server in %s seconds.",
MAX_POLLING_ATTEMPTS * POLLING_INTERVAL / MS_PER_SEC));
}
LOGGER.info("Publishing {} event.", ReactorConfig.STACK_CREATE_SUCCESS_EVENT);
reactor.notify(ReactorConfig.STACK_CREATE_SUCCESS_EVENT, Event.wrap(new StackCreationSuccess(stackId, ambariIp)));
} catch (Exception e) {
LOGGER.error("Unhandled exception occured while trying to reach initializing Ambari server.", e);
LOGGER.info("Publishing {} event.", ReactorConfig.STACK_CREATE_FAILED_EVENT);
StackOperationFailure stackCreationFailure = new StackOperationFailure(stackId,
"Unhandled exception occured while trying to reach initializing Ambari server.");