From 88bd4308019a6e2063fd1c8c7caa9a4ad236e5e6 Mon Sep 17 00:00:00 2001 From: Katerina Date: Mon, 22 Apr 2024 12:49:49 +0300 Subject: [PATCH] Fixed the double save of summary results when 2 guidelines where checked in parallel --- .../validatorapi/processors/SumUpNCleanProcessor.java | 2 -- .../eu/dnetlib/validatorapi/routes/FairOaiPmhRoute2.java | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/dnetlib/validatorapi/processors/SumUpNCleanProcessor.java b/src/main/java/eu/dnetlib/validatorapi/processors/SumUpNCleanProcessor.java index b2c5277..135768e 100644 --- a/src/main/java/eu/dnetlib/validatorapi/processors/SumUpNCleanProcessor.java +++ b/src/main/java/eu/dnetlib/validatorapi/processors/SumUpNCleanProcessor.java @@ -32,8 +32,6 @@ public class SumUpNCleanProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { - Thread stop=null; - ValidationJob validationJob = new ValidationJob(); validationJob.id = (Integer)exchange.getIn().getHeader("validationId"); validationJob.baseUrl = (String)(exchange.getIn().getHeader("baseUrl")); diff --git a/src/main/java/eu/dnetlib/validatorapi/routes/FairOaiPmhRoute2.java b/src/main/java/eu/dnetlib/validatorapi/routes/FairOaiPmhRoute2.java index bf0128a..45f8e6c 100644 --- a/src/main/java/eu/dnetlib/validatorapi/routes/FairOaiPmhRoute2.java +++ b/src/main/java/eu/dnetlib/validatorapi/routes/FairOaiPmhRoute2.java @@ -126,6 +126,7 @@ public class FairOaiPmhRoute2 extends RouteBuilder { .multicast().parallelProcessing() .to("direct:guidelinesProcessor") .to("direct:fairProcessor") + .to("controlbus:route?routeId=1&action=stop&async=true") .endChoice() .otherwise() .process(new ErrorProcessor(validationJob)) @@ -152,11 +153,10 @@ public class FairOaiPmhRoute2 extends RouteBuilder { .choice() .when(header("MyHeader").isEqualTo("stop")) .process(new SumUpNCleanProcessor(validationJobRepository, validationResultRepository, summaryValidationJobRepository, - profile)) + profile)) /*.process(new DataBaseProcessor()) .to("jpa:" + ValidationJob.class.getName() + "?useExecuteUpdate=true")//;.to("direct:saveToDatabase")*/ .to("controlbus:route?routeId="+routeid+"&action=stop&async=true") - .to("controlbus:route?routeId=1&action=stop&async=true") .endChoice() .end(); @@ -183,7 +183,6 @@ public class FairOaiPmhRoute2 extends RouteBuilder { /*.process(new DataBaseProcessor()) .to("jpa:" + ValidationJob.class.getName() + "?useExecuteUpdate=true")//;.to("direct:saveToDatabase")*/ .to("controlbus:route?routeId="+routeid2+"&action=stop&async=true") - .to("controlbus:route?routeId=1&action=stop&async=true") .endChoice() .end();