Module org.apache.jena.base
Package org.apache.jena.base.module
Class Subsystem<T extends SubsystemLifecycle>
java.lang.Object
org.apache.jena.base.module.Subsystem<T>
Subsystem loader "system" - simple controls for ensuring components are loaded and initialized.
This typically uses
ServiceLoader and it adds the concept of a "level"
so that loaded plugins are executed in a controlled order.
Levels are executed in order, from 0 upwards.
Within a level, plugins are executed in arbitrary order.
There should only be one "Subsystem" per "Class<T>".
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddebug(boolean value) Development support - flag to enable output during initialization.voidCall an action on each item in the registry.voidforEachReverse(Consumer<T> action) Call an action on each item in the registry but in the reverse enumeration order.voidInitializevoidlogLifecycle(String fmt, Object... args) Output a debugging message if DEBUG_INIT is setvoidsetSubsystemRegistry(SubsystemRegistry<T> thing) Set theSubsystemRegistry.voidshutdown()Shutdown subsystems
-
Constructor Details
-
Subsystem
-
-
Method Details
-
debug
public void debug(boolean value) Development support - flag to enable output during initialization. Output toSystem.err, not a logger to avoid the risk of recursive initialization. -
initialize
public void initialize()InitializeThis function is cheap to call when already initialized so can be called to be sure. A commonly used idiom in jena is a static initializer in key classes.
By default, initialization happens by using
ServiceLoader.loadto findSubsystemLifecycleobjects. SeesetSubsystemRegistry(org.apache.jena.base.module.SubsystemRegistry<T>)to intercept that choice. -
shutdown
public void shutdown()Shutdown subsystems -
setSubsystemRegistry
Set theSubsystemRegistry. To have any effect, this function must be called before any other Jena code, and especially before callingJenaSystem.init(). -
forEach
Call an action on each item in the registry. Calls are made sequentially and in increasing level order. The exact order within a level is not specified; it is not registration order.- Parameters:
action-
-
forEachReverse
Call an action on each item in the registry but in the reverse enumeration order. Calls are made sequentially and in decreasing level order. The "reverse" is opposite order toforEach(java.util.function.Consumer<T>), which may not be stable within a level. It is not related to registration order.- Parameters:
action-
-
logLifecycle
Output a debugging message if DEBUG_INIT is set
-