You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by GitBox <gi...@apache.org> on 2023/01/07 17:14:43 UTC

[GitHub] [jena-site] kinow commented on a diff in pull request #139: Update system-initialization.md

kinow commented on code in PR #139:
URL: https://github.com/apache/jena-site/pull/139#discussion_r1064026267


##########
source/documentation/notes/system-initialization.md:
##########
@@ -2,54 +2,76 @@
 title: Apache Jena Initialization
 ---
 
-Jena has a simple initialization sequence that is
+Jena has an initialization sequence that is
 used to setup components available at runtime.
 
 Application code is welcome to also use this mechanism. This
-must be done with care. Java initialization can lead to
-visibility of uninitialized data.
+must be done with care. During Jena initialization, there can be 
+visibility of uninitialized data in class static members.
 
 The standard initialization sequence is  
 Core -> RIOT -> ARQ -> TDB -> other (including jena text)
 
-The sequence from core to TDB should be executed before application
-components. See below for how to control the order.
+The sequence from 0 to level 500 is the Jena platform
+initialization. Application may use the jena initialization mechanism and it is
+recommended to place initialzation code above level 500.
 
 Initialization occurs when `JenaSystem.init()` is first called.  Jena ensures that this
 is done when the application first uses any Jena code by using class
 initializers.
 
+Application can call `JenaSystem.init()`. 
+
 See [notes on repacking Jena code](jena-repack.html) for how to deal
-with ServiceLoader files in repacked jars.
+with `ServiceLoader` files in repacked jars.
 
 ## Initialization code
 
-Initialization code is an implementation of `JenaSubsystemLifecycle`.
-For use in the default initialization, the class must have a zero-argument constructor
+Initialization code is an implementation of `JenaSubsystemLifecycle` which
+itself extends `SubsystemLifecycle`.
+
+For use in the default initialization, the class must have a zero-argument
+constructor and implement:
 
+```java
     public interface JenaSubsystemLifecycle {
         public void start() ;
         public void stop() ;
         default public int level() { return 9999 ; }
     }
+```
 
-The code also supply a level, indicating its place in the order of initialization.
+The code should supply a level, indicating its place in the order of initialization.
 The levels used by Jena are:
 
 * 0 - reserved
 * 10 - Used by jena-core
+* 15 - CLI Commands registry
 * 20 - RIOT
 * 30 - ARQ
-* 40 - TDB
-* 9999 - other
+* 40 - Text indexing
+* 40 - TDB1
+* 42 - TDB2
+* 60 - Additional HTTP configuration
+* 60 - RDFPatch
+* 96 - SHACL
+* 96 - ShEx
+* 101 - Fuseki
+* 9999 - Default.
+
+Levels up to 500 are considered to be "Jena system level", Application code
+should use level above 500.
+
+Fuseki initialization includes [Fuseki
+Modules](/documentation/fuseki2/fuseki-modules) which uses `SubsystemLifecycle`
+with a different Java interface.
 
 ## The Initialization Process
 
-The process followed by `JenaSystem.init()` is to obtain an instance of
-`JenaSubsystemRegistry`, ask it to `load()` initialization code, then call
-that code in an order based on declared level. The order of invocation
-of different initialization code within the same level is undefined
-and may be different from run to run.
+The process followed by `JenaSystem.init()` is to load all java `ServiceLoader`
+regsitered `JenaSubsystemLifecycle`, sort into level order, then call `init` on

Review Comment:
   s/regsitered/registered



##########
source/documentation/notes/system-initialization.md:
##########
@@ -2,54 +2,76 @@
 title: Apache Jena Initialization
 ---
 
-Jena has a simple initialization sequence that is
+Jena has an initialization sequence that is
 used to setup components available at runtime.
 
 Application code is welcome to also use this mechanism. This
-must be done with care. Java initialization can lead to
-visibility of uninitialized data.
+must be done with care. During Jena initialization, there can be 
+visibility of uninitialized data in class static members.
 
 The standard initialization sequence is  
 Core -> RIOT -> ARQ -> TDB -> other (including jena text)
 
-The sequence from core to TDB should be executed before application
-components. See below for how to control the order.
+The sequence from 0 to level 500 is the Jena platform
+initialization. Application may use the jena initialization mechanism and it is
+recommended to place initialzation code above level 500.

Review Comment:
   s/initialzation/initialization



-- 
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: dev-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org