diff --git a/base/src/main/java/de/staropensource/sosengine/base/Engine.java b/base/src/main/java/de/staropensource/sosengine/base/Engine.java index 1fd83420..720078d0 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/Engine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/Engine.java @@ -319,14 +319,16 @@ public final class Engine implements SubsystemMainClass { // Initialize subsystems logger.info("Initializing engine subsystems"); + long initTime; for (DependencySubsystemVector vector : subsystems) { - logger.verb("Initializing subsystem " + vector.getMainClass().getClass().getName()); + logger.diag("Initializing subsystem " + vector.getMainClass().getName() + " (" + vector.getMainClass().getClass().getName() + ")"); try { - vector.getMainClass().initializeSubsystem(); + initTime = Miscellaneous.measureExecutionTime(() -> vector.getMainClass().initializeSubsystem()); } catch (Throwable throwable) { - logger.crash("An error occurred trying to initialize subsystem " + vector.getMainClass().getClass().getName() + ": " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage())); + logger.crash("An error occurred trying to initialize subsystem " + vector.getMainClass().getName() + " (" + vector.getMainClass().getClass().getName() + "): " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage())); throw throwable; } + logger.diag("Initialized subsystem " + vector.getMainClass().getName() + " (" + vector.getMainClass().getClass().getName() + ") in " + initTime + "ms"); } // Update 'subsystems' @@ -363,6 +365,15 @@ public final class Engine implements SubsystemMainClass { Runtime.getRuntime().exit(exitCode); } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getName() { + return "base"; + } + /** {@inheritDoc} */ @Override public void initializeSubsystem() {} diff --git a/base/src/main/java/de/staropensource/sosengine/base/annotations/EngineSubsystem.java b/base/src/main/java/de/staropensource/sosengine/base/annotations/EngineSubsystem.java index 090e2710..290da870 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/annotations/EngineSubsystem.java +++ b/base/src/main/java/de/staropensource/sosengine/base/annotations/EngineSubsystem.java @@ -19,11 +19,16 @@ package de.staropensource.sosengine.base.annotations; +import de.staropensource.sosengine.base.classes.SubsystemMainClass; + import java.lang.annotation.*; /** * This annotation marks a class as a subsystem main class. + *
+ * Make sure your subsystem implements {@link SubsystemMainClass}. * + * @see SubsystemMainClass * @since v1-alpha1 */ @SuppressWarnings("unused") diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java b/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java index b7a22253..d69134f3 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/SubsystemMainClass.java @@ -20,6 +20,7 @@ package de.staropensource.sosengine.base.classes; import de.staropensource.sosengine.base.Engine; +import de.staropensource.sosengine.base.annotations.EngineSubsystem; import de.staropensource.sosengine.base.annotations.EventListener; import de.staropensource.sosengine.base.internal.events.InternalEngineShutdownEvent; import de.staropensource.sosengine.base.logging.LoggerInstance; @@ -29,6 +30,7 @@ import org.jetbrains.annotations.NotNull; /** * The interface for engine subsystem main classes. * + * @see EngineSubsystem * @since v1-alpha0 */ @SuppressWarnings({ "unused" }) @@ -41,6 +43,14 @@ public interface SubsystemMainClass { */ LoggerInstance logger = null; + /** + * Returns the name of this subsystem. + * + * @since v1-alpha2 + */ + @NotNull + String getName(); + /** * Initializes this subsystem. * diff --git a/base/src/main/javadoc/overview.html b/base/src/main/javadoc/overview.html index 503a23db..d79ef2df 100644 --- a/base/src/main/javadoc/overview.html +++ b/base/src/main/javadoc/overview.html @@ -20,11 +20,4 @@
Welcome to the sos!engine API documentation!
You are currently in the documentation for the base subsystem, the core of the engine.
The most interesting parts for developers wanting to use the engine are:
-