afs commented on code in PR #1805:
URL: https://github.com/apache/jena/pull/1805#discussion_r1141088004
##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/sys/FusekiModules.java:
##########
@@ -18,67 +18,56 @@
package org.apache.jena.fuseki.main.sys;
-import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
-import org.apache.jena.base.module.Subsystem;
-
-/** Registry of modules */
+/**
+ * List of {@linkplain FusekiModule Fuseki modules}.
+ * This is the immutable unit of a modules for a server.
+ * <p>
+ * @see FusekiModulesLoaded
+ */
public class FusekiModules {
- private static Object lock = new Object();
+ /** A Fuseki module with no members. */
+ public static FusekiModules empty = FusekiModules.create();
- // Record of what is loaded.
- private static List<FusekiModule> registry = null;
-
- private static Subsystem<FusekiModule> subsystem = null;
+ /** Create a collection of Fuseki modules */
+ public static FusekiModules create(FusekiModule ... modules) {
+ return new FusekiModules(modules);
+ }
- public static void load() {
- if ( registry == null )
- reload();
+ /** Create a collection of Fuseki modules */
+ public static FusekiModules create(List<FusekiModule> modules) {
+ return new FusekiModules(modules);
}
- public static void reload() {
- registry = new ArrayList<>();
- subsystem = new Subsystem<FusekiModule>(FusekiModule.class);
- subsystem.initialize();
- synchronized(lock) {
- subsystem.forEach(registry::add);
- }
+ private final List<FusekiModule> modules;
+
+ private FusekiModules(FusekiModule ... modules) {
+ this.modules = List.of(modules);
Review Comment:
Done. Always good to check early - this is unlikely to be performance
critical code.
##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/sys/FusekiModules.java:
##########
@@ -18,67 +18,56 @@
package org.apache.jena.fuseki.main.sys;
-import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
-import org.apache.jena.base.module.Subsystem;
-
-/** Registry of modules */
+/**
+ * List of {@linkplain FusekiModule Fuseki modules}.
+ * This is the immutable unit of a modules for a server.
+ * <p>
+ * @see FusekiModulesLoaded
+ */
public class FusekiModules {
- private static Object lock = new Object();
+ /** A Fuseki module with no members. */
+ public static FusekiModules empty = FusekiModules.create();
Review Comment:
Yes!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]