Interface ModuleInitializer

All Known Implementing Classes:
CLIModuleEntrypoint, GLFWRenderModuleEntrypoint, RenderModuleEntrypoint, SimulatorModuleEntrypoint, VulkanGLFWRenderModuleEntrypoint, VulkanModuleEntrypoint, VulkanRenderModuleEntrypoint, WebserverModuleEntrypoint

public interface ModuleInitializer
A module's main entrypoint, the object the engine drives during initialization.

Every module registers exactly one of these. The engine invokes onInitialize() on all of them concurrently, so a module must not assume anything about the order in which its peers come up; the only ordering guarantee available is the one the dependency handshake provides.

Implementations must satisfy requirements R12 through R16 of the Module System Specification.

  • Method Details

    • onInitialize

      void onInitialize()
      Brings this module up.

      An implementation sets its logger's level from the engine's configuration, loads its own configuration and saves it if loading substituted defaults, receives any dependencies it declares through getDependencyModuleTransferQueue(), performs any operations it must perform during initialization, and finally invokes its own dependent entrypoints, passing itself.

    • getConfig

      ModuleConfig getConfig()
      Returns this module's configuration.
      Returns:
      the configuration, or null before onInitialize() has loaded it
    • getLogger

      Logger getLogger()
      Returns the logger this module writes its diagnostics to.

      The same instance is returned for the lifetime of this entrypoint.

      Returns:
      this module's logger
    • getDependencyModuleTransferQueue

      TransferQueue<ModuleInitializer> getDependencyModuleTransferQueue()
      Returns the queue by which this module receives the entrypoints it depends on.

      A module does not look its dependencies up. Each module it depends on invokes a dependent entrypoint, which transfers that module's own entrypoint into this queue. The same instance is returned for the lifetime of this entrypoint; a fresh or defensively copied queue breaks the handshake, because the producer transfers into whichever queue this method returned.

      Returns:
      this module's dependency transfer queue