use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class SdxStopAllDatahubHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxStopAllDatahubRequest> event) {
SdxStopAllDatahubRequest stopAllDatahubRequest = event.getData();
Long sdxId = stopAllDatahubRequest.getResourceId();
String userId = stopAllDatahubRequest.getUserId();
Selectable response;
try {
LOGGER.debug("Polling is started for the operation of stopping all datahubs clusters for sdx with id: {}", sdxId);
sdxStopService.stopAllDatahub(sdxId);
response = new SdxEvent(SdxStopEvent.SDX_STOP_IN_PROGRESS_EVENT.event(), sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Polling exited before timeout. Cause ", userBreakException);
response = new SdxStopFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Poller stopped for stack: " + sdxId, pollerStoppedException);
response = new SdxStopFailedEvent(sdxId, userId, new PollerStoppedException("Datalake stop timed out after " + DURATION_IN_MINUTES + " minutes", pollerStoppedException));
} catch (PollerException exception) {
LOGGER.error("Polling failed for stack: {}", sdxId);
response = new SdxStopFailedEvent(sdxId, userId, exception);
} catch (BadRequestException badRequest) {
LOGGER.error("Datahub stop failed.", badRequest);
response = new SdxStopFailedEvent(sdxId, userId, badRequest);
}
return response;
}
Aggregations