Search in sources :

Example 1 with SdxOperationFailedException

use of com.sequenceiq.environment.exception.SdxOperationFailedException in project cloudbreak by hortonworks.

the class SdxDeleteService method waitSdxClustersDeletion.

private void waitSdxClustersDeletion(PollingConfig pollingConfig, EnvironmentView environment, Set<String> sdxCrnsOrDatalakeName, boolean legacySdxEndpoint, boolean force) {
    LOGGER.debug("Calling sdxEndpoint.deleteByCrn for all data lakes [{}]", String.join(", ", sdxCrnsOrDatalakeName));
    if (legacySdxEndpoint) {
        String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
        sdxCrnsOrDatalakeName.forEach(name -> ThreadBasedUserCrnProvider.doAsInternalActor(() -> stackV4Endpoint.deleteInternal(0L, name, force, initiatorUserCrn)));
    } else {
        sdxCrnsOrDatalakeName.forEach(crn -> sdxEndpoint.deleteByCrn(crn, force));
    }
    LOGGER.debug("Starting poller to check all Data Lake stacks for environment {} is deleted", environment.getName());
    try {
        Polling.stopAfterDelay(pollingConfig.getTimeout(), pollingConfig.getTimeoutTimeUnit()).stopIfException(pollingConfig.getStopPollingIfExceptionOccured()).waitPeriodly(pollingConfig.getSleepTime(), pollingConfig.getSleepTimeUnit()).run(() -> periodicCheckForDeletion(environment));
    } catch (PollerStoppedException e) {
        LOGGER.info("Datalake deletion timed out");
        throw new SdxOperationFailedException("Datalake deletion timed out");
    }
}
Also used : SdxOperationFailedException(com.sequenceiq.environment.exception.SdxOperationFailedException) PollerStoppedException(com.dyngr.exception.PollerStoppedException)

Aggregations

PollerStoppedException (com.dyngr.exception.PollerStoppedException)1 SdxOperationFailedException (com.sequenceiq.environment.exception.SdxOperationFailedException)1