use of com.mercedesbenz.sechub.sharedkernel.Abandonable in project sechub by mercedes-benz.
the class ScanJobExecutor method handleCanceled.
private void handleCanceled(CanceableScanJobRunnable canceableJobRunner, UUID sechubJobUUID) throws SecHubExecutionAbandonedException {
LOG.info("Received cancel signal, so start canceling job: {}", sechubJobUUID);
canceableJobRunner.cancelScanJob();
if (!(progress instanceof Abandonable)) {
return;
}
Abandonable abandoble = (Abandonable) progress;
LOG.info("Check if job {} shall be abandoned", sechubJobUUID);
if (abandoble.isAbandoned()) {
LOG.info("Must abandon {}", sechubJobUUID);
throw new SecHubExecutionAbandonedException(context, "Abandonded job " + sechubJobUUID + " because canceled", null);
}
}
use of com.mercedesbenz.sechub.sharedkernel.Abandonable in project sechub by mercedes-benz.
the class ScanJobExecutor method handleErrors.
private void handleErrors(SecHubExecutionException exception) throws SecHubExecutionException {
if (exception == null) {
/* no failure - so just return */
return;
}
/*
* abdoned exception are treated special: executor will NOT persist result in
* this case!
*/
if (exception instanceof SecHubExecutionAbandonedException) {
LOG.debug("Rethrow SecHubExecutionAbandonedException");
// just rethrow abandoned
throw exception;
}
LOG.debug("No SecHubExecutionAbandonedException");
if (progress instanceof Abandonable) {
LOG.debug("Start abandoble check");
Abandonable abandonable = (Abandonable) progress;
if (abandonable.isAbandoned()) {
LOG.debug("Done abandoble check- IS abandonded");
throw new SecHubExecutionAbandonedException(context, "A failure happend, but already abandoned job", exception);
}
LOG.debug("Done abandoble check- not abandonded");
}
LOG.debug("Rethrow normal sechub execution exception");
throw exception;
}
Aggregations