Class Subsystem<T extends SubsystemLifecycle>

java.lang.Object
org.apache.jena.base.module.Subsystem<T>

public class Subsystem<T extends SubsystemLifecycle> extends Object
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 Details

    • Subsystem

      public Subsystem(Class<T> cls)
  • Method Details

    • debug

      public void debug(boolean value)
      Development support - flag to enable output during initialization. Output to System.err, not a logger to avoid the risk of recursive initialization.
    • initialize

      public void initialize()
      Initialize

      This 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.load to find SubsystemLifecycle objects. See setSubsystemRegistry(org.apache.jena.base.module.SubsystemRegistry<T>) to intercept that choice.

    • shutdown

      public void shutdown()
      Shutdown subsystems
    • setSubsystemRegistry

      public void setSubsystemRegistry(SubsystemRegistry<T> thing)
      Set the SubsystemRegistry. To have any effect, this function must be called before any other Jena code, and especially before calling JenaSystem.init().
    • forEach

      public void forEach(Consumer<T> action)
      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

      public void forEachReverse(Consumer<T> action)
      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 to forEach(java.util.function.Consumer<T>), which may not be stable within a level. It is not related to registration order.
      Parameters:
      action -
    • logLifecycle

      public void logLifecycle(String fmt, Object... args)
      Output a debugging message if DEBUG_INIT is set