From 915a76a7964e8b3fd4da8bef717d03c33209d9d2 Mon Sep 17 00:00:00 2001 From: "sandro.labruzzo" Date: Wed, 28 Feb 2024 09:10:55 +0100 Subject: [PATCH] following the comment on the pull requests: - Added #NUM_OF_THREADS complete job in the queue at the end of the main loop to avoid deadlock --- .../java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java | 1 - .../dnetlib/dhp/collection/orcid/OrcidGetUpdatesFile.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java index fe59fe71f6..2767a3e41d 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/ORCIDWorker.java @@ -135,7 +135,6 @@ public class ORCIDWorker extends Thread { orcidId = queue.take(); if (orcidId.equalsIgnoreCase(JOB_COMPLETE)) { - queue.put(orcidId); hasComplete = true; } else { start = System.currentTimeMillis(); diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/OrcidGetUpdatesFile.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/OrcidGetUpdatesFile.java index c964231472..eb23a204f1 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/OrcidGetUpdatesFile.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/orcid/OrcidGetUpdatesFile.java @@ -155,15 +155,17 @@ public class OrcidGetUpdatesFile { throw new RuntimeException(e); } }); - queue.put(ORCIDWorker.JOB_COMPLETE); + } } + for (int i = 0; i < 22; i++) { + queue.put(ORCIDWorker.JOB_COMPLETE); + } for (ORCIDWorker worker : workers) { worker.join(); } - } }