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