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

commit f03da03386bfe833baca61f2811f5ff5066cfb20
Author: Andy Seaborne <[email protected]>
AuthorDate: Tue Jul 15 21:18:04 2025 +0100

    Make adding commands more robust
---
 jena-cmds/src/main/java/org/apache/jena/cmd/Cmds.java | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/jena-cmds/src/main/java/org/apache/jena/cmd/Cmds.java 
b/jena-cmds/src/main/java/org/apache/jena/cmd/Cmds.java
index 8b9567867b..a879fd982f 100644
--- a/jena-cmds/src/main/java/org/apache/jena/cmd/Cmds.java
+++ b/jena-cmds/src/main/java/org/apache/jena/cmd/Cmds.java
@@ -18,8 +18,8 @@
 
 package org.apache.jena.cmd;
 
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Consumer;
 
 import org.apache.jena.sys.JenaSystem;
@@ -32,15 +32,11 @@ public class Cmds {
 
     static { JenaSystem.init(); }
 
-    private static Map<String, Consumer<String[]>> cmds;
+    private static Map<String, Consumer<String[]>> cmds = new 
ConcurrentHashMap<>();
+    private static Object lock = new Object();
 
     // Initialize via JenaSubsystemLifecycle and not rely on class 
initialization.
-    static void init() {
-        // Initialization should be minimal, just enough to allow modules to 
register commands.
-        // We may be inside some other place where JenaSystem.init() was 
called.
-        if ( cmds == null )
-            cmds = new HashMap<>();
-    }
+    static void init() {}
 
     public static void injectCmd(String name, Consumer<String[]> main) {
         cmds.put(name, main);

Reply via email to