You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by gi...@apache.org on 2023/01/07 20:15:07 UTC

[jena-site] branch asf-site updated: Updated site from main (abba6bfcf4215a7511aebe4e5876c009121c2162)

This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/jena-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 601964099 Updated site from main (abba6bfcf4215a7511aebe4e5876c009121c2162)
601964099 is described below

commit 6019640996cde8d9800705e18265a8be9dc40c8d
Author: jenkins <bu...@apache.org>
AuthorDate: Sat Jan 7 20:15:04 2023 +0000

    Updated site from main (abba6bfcf4215a7511aebe4e5876c009121c2162)
---
 content/documentation/index.xml                    |   6 +-
 .../documentation/notes/system-initialization.html | 107 +++++++--------------
 content/index.xml                                  |   6 +-
 content/sitemap.xml                                |   4 +-
 4 files changed, 45 insertions(+), 78 deletions(-)

diff --git a/content/documentation/index.xml b/content/documentation/index.xml
index 0fef8c0c5..c8e2b1325 100644
--- a/content/documentation/index.xml
+++ b/content/documentation/index.xml
@@ -134,11 +134,11 @@ Getting Started GeoSPARQL Jena can be accessed as a library using Maven etc. fro
       <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
       
       <guid>https://jena.apache.org/documentation/notes/system-initialization.html</guid>
-      <description>Jena has a simple 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.
+      <description>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. During Jena initialization, there can be visibility of uninitialized data in class static members.
 The standard initialization sequence is
 Core -&amp;gt; RIOT -&amp;gt; ARQ -&amp;gt; TDB -&amp;gt; other (including jena text)
-The sequence from core to TDB should be executed before application components. See below for how to control the order.</description>
+The sequence from 0 to level 500 is the Jena platform initialization.</description>
     </item>
     
     <item>
diff --git a/content/documentation/notes/system-initialization.html b/content/documentation/notes/system-initialization.html
index 8bf149328..9fef696c5 100644
--- a/content/documentation/notes/system-initialization.html
+++ b/content/documentation/notes/system-initialization.html
@@ -182,103 +182,70 @@
             </div>
             <h1 class="title">Apache Jena Initialization</h1>
             
-	<p>Jena has a simple initialization sequence that is
+	<p>Jena has an initialization sequence that is
 used to setup components available at runtime.</p>
 <p>Application code is welcome to also use this mechanism. This
-must be done with care. Java initialization can lead to
-visibility of uninitialized data.</p>
+must be done with care. During Jena initialization, there can be
+visibility of uninitialized data in class static members.</p>
 <p>The standard initialization sequence is<br>
 Core -&gt; RIOT -&gt; ARQ -&gt; TDB -&gt; other (including jena text)</p>
-<p>The sequence from core to TDB should be executed before application
-components. See below for how to control the order.</p>
+<p>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 initialization code above level 500.</p>
 <p>Initialization occurs when <code>JenaSystem.init()</code> is first called.  Jena ensures that this
 is done when the application first uses any Jena code by using class
 initializers.</p>
+<p>Application can call <code>JenaSystem.init()</code>.</p>
 <p>See <a href="jena-repack.html">notes on repacking Jena code</a> for how to deal
-with ServiceLoader files in repacked jars.</p>
+with <code>ServiceLoader</code> files in repacked jars.</p>
 <h2 id="initialization-code">Initialization code</h2>
-<p>Initialization code is an implementation of <code>JenaSubsystemLifecycle</code>.
-For use in the default initialization, the class must have a zero-argument constructor</p>
-<pre><code>public interface JenaSubsystemLifecycle {
-    public void start() ;
-    public void stop() ;
-    default public int level() { return 9999 ; }
-}
-</code></pre>
-<p>The code also supply a level, indicating its place in the order of initialization.
+<p>Initialization code is an implementation of <code>JenaSubsystemLifecycle</code> which
+itself extends <code>SubsystemLifecycle</code>.</p>
+<p>For use in the default initialization, the class must have a zero-argument
+constructor and implement:</p>
+<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java">    <span style="color:#a2f;font-weight:bold">public</span> <span style="color:#a2f;font-weight:bold">interface</span> <span style="color:#00f">JenaSubsystemLifecycle</span> <span style="color:#666">{</span>
+        <span style="color:#a2f;font-weight:bold">public</span> <span style="color:#0b0;font-weight:bold">void</span> <span style="color:#00a000">start</span><span style="color:#666">()</span> <span style="color:#666">;</span>
+        <span style="color:#a2f;font-weight:bold">public</span> <span style="color:#0b0;font-weight:bold">void</span> <span style="color:#00a000">stop</span><span style="color:#666">()</span> <span style="color:#666">;</span>
+        <span style="color:#a2f;font-weight:bold">default</span> <span style="color:#a2f;font-weight:bold">public</span> <span style="color:#0b0;font-weight:bold">int</span> <span style="color:#00a000">level</span><span style="color:#666">()</span> <span style="color:#666">{</span> <span style="color:#a2f;font-weight:bold">return</span> 9999 <span style="color:#666">;</span> <span style="color:#666">}</span>
+    <span style="color:#666">}</span>
+</code></pre></div><p>The code should supply a level, indicating its place in the order of initialization.
 The levels used by Jena are:</p>
 <ul>
 <li>0 - reserved</li>
 <li>10 - Used by jena-core</li>
+<li>15 - CLI Commands registry</li>
 <li>20 - RIOT</li>
 <li>30 - ARQ</li>
-<li>40 - TDB</li>
-<li>9999 - other</li>
+<li>40 - Text indexing</li>
+<li>40 - TDB1</li>
+<li>42 - TDB2</li>
+<li>60 - Additional HTTP configuration</li>
+<li>60 - RDFPatch</li>
+<li>96 - SHACL</li>
+<li>96 - ShEx</li>
+<li>101 - Fuseki</li>
+<li>9999 - Default.</li>
 </ul>
+<p>Levels up to 500 are considered to be &ldquo;Jena system level&rdquo;, Application code
+should use level above 500.</p>
+<p>Fuseki initialization includes <a href="/documentation/fuseki2/fuseki-modules">Fuseki
+Modules</a> which uses <code>SubsystemLifecycle</code>
+with a different Java interface.</p>
 <h2 id="the-initialization-process">The Initialization Process</h2>
-<p>The process followed by <code>JenaSystem.init()</code> is to obtain an instance of
-<code>JenaSubsystemRegistry</code>, ask it to <code>load()</code> 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.</p>
+<p>The process followed by <code>JenaSystem.init()</code> is to load all java <code>ServiceLoader</code>
+registered <code>JenaSubsystemLifecycle</code>, sort into level order, then call <code>init</code> on
+each initialization object. Initialization code at the same level may be called
+in any order and that order may be different between runs.</p>
 <p>Only the first call of <code>JenaSystem.init()</code> causes the process to run.
 Any subsequent calls are cheap, so calling <code>JenaSystem.init()</code>
 when in doubt about the initialization state is safe.</p>
 <p>Overlapping concurrent calls to <code>JenaSystem.init()</code> are thread-safe.
 On a return from <code>JenaSystem.init()</code>, Jena has been initialized at some point.</p>
-<h2 id="the-standard-subsystem-registry">The Standard Subsystem Registry</h2>
-<p>The <code>JenaSubsystemRegistry</code> normally used is based on <code>java.util.ServiceLoader</code>.
-It looks for class resources
-<code>META-INF/services/org.apache.jena.sys.JenaSubsystemLifecycle</code>
-on the classpath during the load step.</p>
-<p>See the javadoc for <code>java.util.ServiceLoader</code> for more details.</p>
-<p>See also the javadoc for
-<a href="/documentation/javadoc/jena/org/apache/jena/system/JenaSystem.html">JenaSystem</a>
-and the source code.</p>
 <h2 id="debugging">Debugging</h2>
 <p>There is a flag <code>JenaSystem.DEBUG_INIT</code> to help with development. It is not
 intended for runtime logging.</p>
 <p>Jena components print their initialization beginning and end points on
 <code>System.err</code> to help track down ordering issues.</p>
-<h2 id="modifying-the-standard-process">Modifying the Standard Process</h2>
-<p>It is possible, with care, to alter the way
-that initialization code is discovered.</p>
-<p>An application can change the <code>JenaSubsystemRegistry</code> instance.
-This must be done before any Jena code is called anywhere
-in the current JVM.</p>
-<pre><code>// Example alternative registry.
-JenaSubsystemRegistry r = new JenaSubsystemRegistryBasic() {
-    @Override
-    public void load() {
-        if ( JenaSystem.DEBUG_INIT )
-            System.err.println(&quot;Example custom load&quot;) ;
-        super.load();
-    }
-} ;
-
-// Set the sub-system registry
-JenaSystem.setSubsystemRegistry(r);
-
-// Enable output if required
-// JenaSystem.DEBUG_INIT = true ;
-
-// Initialize Jena
-JenaSystem.init() ;
-</code></pre>
-<h2 id="jena-initialization-in-multi-classloader-environments">Jena initialization in multi-classloader environments</h2>
-<p>In some applications with multiple classloaders, or different classloader strategies, Jena initialization may
-not work as expected. If the Jena initialization debug information shows that components were not loaded correctly,
-trying to switch the context class loader may fix the initialization process.</p>
-<pre><code>ClassLoader contextClassLoader = null;
-try {
-    contextClassLoader = Thread.currentThread().getContextClassLoader();
-    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-    JenaSystem.DEBUG_INIT = true;
-    // ...
-} finally {
-    Thread.currentThread().setContextClassLoader(contextClassLoader);
-}
-</code></pre>
 
 
         </div>
diff --git a/content/index.xml b/content/index.xml
index 5adf49f75..a2a35008f 100644
--- a/content/index.xml
+++ b/content/index.xml
@@ -154,11 +154,11 @@ Getting Started GeoSPARQL Jena can be accessed as a library using Maven etc. fro
       <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
       
       <guid>https://jena.apache.org/documentation/notes/system-initialization.html</guid>
-      <description>Jena has a simple 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.
+      <description>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. During Jena initialization, there can be visibility of uninitialized data in class static members.
 The standard initialization sequence is
 Core -&amp;gt; RIOT -&amp;gt; ARQ -&amp;gt; TDB -&amp;gt; other (including jena text)
-The sequence from core to TDB should be executed before application components. See below for how to control the order.</description>
+The sequence from 0 to level 500 is the Jena platform initialization.</description>
     </item>
     
     <item>
diff --git a/content/sitemap.xml b/content/sitemap.xml
index 7579852ce..30098dea2 100644
--- a/content/sitemap.xml
+++ b/content/sitemap.xml
@@ -74,7 +74,7 @@
   
   <url>
     <loc>https://jena.apache.org/documentation/notes/system-initialization.html</loc>
-    <lastmod>2021-03-16T21:05:16+00:00</lastmod>
+    <lastmod>2023-01-07T15:49:38+00:00</lastmod>
   </url>
   
   <url>
@@ -334,7 +334,7 @@
   
   <url>
     <loc>https://jena.apache.org/documentation.html</loc>
-    <lastmod>2023-01-07T10:20:20+01:00</lastmod>
+    <lastmod>2023-01-07T15:49:38+00:00</lastmod>
   </url>
   
   <url>