From ab114b092057f23015ac26a6ae68ca9fd0bec1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominique=20Eifl=C3=A4nder?= Date: Mon, 19 Aug 2024 13:18:00 +0200 Subject: [PATCH] RED-9837: Fixed not working timeout with endless loop in drools then block --- .../service/drools/ComponentDroolsExecutionService.java | 5 +++-- .../server/service/drools/EntityDroolsExecutionService.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/ComponentDroolsExecutionService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/ComponentDroolsExecutionService.java index 101b3fd6..ec76583e 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/ComponentDroolsExecutionService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/ComponentDroolsExecutionService.java @@ -95,8 +95,7 @@ public class ComponentDroolsExecutionService { }); try { - completableFuture.orTimeout(settings.getDroolsExecutionTimeoutSecs(document.getNumberOfPages()), TimeUnit.SECONDS) - .get(); + completableFuture.get(settings.getDroolsExecutionTimeoutSecs(document.getNumberOfPages()), TimeUnit.SECONDS); } catch (ExecutionException e) { kieSession.dispose(); if (e.getCause() instanceof TimeoutException) { @@ -106,6 +105,8 @@ public class ComponentDroolsExecutionService { } catch (InterruptedException e) { kieSession.dispose(); throw new RuntimeException(e); + } catch (TimeoutException e) { + throw new DroolsTimeoutException(e, false, RuleFileType.COMPONENT); } List resultingFileAttributes = getFileAttributes(kieSession); diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/EntityDroolsExecutionService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/EntityDroolsExecutionService.java index fbe4ccc9..0ec900c6 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/EntityDroolsExecutionService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/EntityDroolsExecutionService.java @@ -129,8 +129,7 @@ public class EntityDroolsExecutionService { }); try { - completableFuture.orTimeout(settings.getDroolsExecutionTimeoutSecs(document.getNumberOfPages()), TimeUnit.SECONDS) - .get(); + completableFuture.get(settings.getDroolsExecutionTimeoutSecs(document.getNumberOfPages()), TimeUnit.SECONDS); } catch (ExecutionException e) { kieSession.dispose(); if (e.getCause() instanceof TimeoutException) { @@ -140,6 +139,8 @@ public class EntityDroolsExecutionService { } catch (InterruptedException e) { kieSession.dispose(); throw new RuntimeException(e); + } catch (TimeoutException e) { + throw new DroolsTimeoutException(e, false, RuleFileType.ENTITY); } List resultingFileAttributes = getFileAttributes(kieSession); -- 2.47.2