From 2cb0e404dd7468ef47d36ca032a39b9f8fbfcf82 Mon Sep 17 00:00:00 2001 From: Antoine Bouhours <123802855+antoinebhs@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:56:09 +0100 Subject: [PATCH] Don't log the cancellation exception. (#52) Get a consistent implementation with respect to other calculation services. --- .../server/service/SensitivityAnalysisWorkerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisWorkerService.java b/src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisWorkerService.java index dc00c4b1..ffd9e069 100644 --- a/src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisWorkerService.java +++ b/src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisWorkerService.java @@ -41,6 +41,7 @@ import java.util.function.Consumer; import java.util.function.Function; +import static org.gridsuite.sensitivityanalysis.server.service.NotificationService.CANCEL_MESSAGE; import static org.gridsuite.sensitivityanalysis.server.service.NotificationService.FAIL_MESSAGE; /** @@ -211,6 +212,7 @@ private void cancelSensitivityAnalysisAsync(SensitivityAnalysisCancelContext can private void cleanSensitivityAnalysisResultsAndPublishCancel(UUID resultUuid, String receiver) { resultRepository.delete(resultUuid); notificationService.publishStop(resultUuid, receiver); + LOGGER.info(CANCEL_MESSAGE + " (resultUuid='{}')", resultUuid); } @Bean @@ -241,8 +243,8 @@ public Consumer> consumeRun() { } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Exception | OutOfMemoryError e) { - LOGGER.error(FAIL_MESSAGE, e); if (!(e instanceof CancellationException)) { + LOGGER.error(FAIL_MESSAGE, e); notificationService.publishFail(resultContext.getResultUuid(), resultContext.getRunContext().getReceiver(), e.getMessage()); resultRepository.delete(resultContext.getResultUuid()); resultRepository.insertStatus(List.of(resultContext.getResultUuid()), SensitivityAnalysisStatus.FAILED.name());