use of com.sequenceiq.datalake.flow.start.event.SdxStartWaitRequest in project cloudbreak by hortonworks.
the class SdxStartWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxStartWaitRequest> event) {
SdxStartWaitRequest waitRequest = event.getData();
Long sdxId = waitRequest.getResourceId();
String userId = waitRequest.getUserId();
Selectable response;
try {
LOGGER.debug("Start polling stack start process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxStartService.waitCloudbreakCluster(sdxId, pollingConfig);
response = new SdxStartSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Start polling exited before timeout. Cause: ", userBreakException);
response = new SdxStartFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Start poller stopped for stack: {}", sdxId);
response = new SdxStartFailedEvent(sdxId, userId, new PollerStoppedException("Datalake start timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Start polling failed for stack: {}", sdxId);
response = new SdxStartFailedEvent(sdxId, userId, exception);
}
return response;
}
Aggregations