This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
The following commit(s) were added to refs/heads/main by this push:
new 741a621f90 GH-2382 - Track engine instances in a Set rather than a List
741a621f90 is described below
commit 741a621f9028f92ebd8b0872ad500b5e7f8e28bb
Author: peter royal <[email protected]>
AuthorDate: Fri Apr 26 19:37:36 2024 +0000
GH-2382 - Track engine instances in a Set rather than a List
The collection of active interpreters is removed from randomly - as each
one completes. This results in random removals from the linked list, a O(n)
operation.
As the number of active interpreters grows, so does this time. This happens
within a synchronized block, which can stall the work of other threads when a
model is shared across threads for reads.
---
.../java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
index 0218731d28..d35c845c8a 100644
---
a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
+++
b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
@@ -59,8 +59,8 @@ public class LPBRuleEngine {
/** Set to true to flag that derivations should be logged */
protected boolean recordDerivations;
- /** List of engine instances which are still processing queries */
- protected List<LPInterpreter> activeInterpreters = new LinkedList<>();
+ /** Set of engine instances which are still processing queries */
+ protected Collection<LPInterpreter> activeInterpreters = new HashSet<>();
protected final int MAX_CACHED_TABLED_GOALS = Integer.parseInt(
JenaRuntime.getSystemProperty("jena.rulesys.lp.max_cached_tabled_goals",
"524288"));