Interface PluginFactory


  • public interface PluginFactory
    A functional interface representing a factory for creating Plugin instances.

    This is typically used in scenarios where plugin instantiation needs to be deferred or customized, potentially based on configuration or context available at runtime. Implementations might handle loading WASM modules, configuring builders, and returning the ready-to-use plugin.

    • Method Detail

      • create

        Plugin create()
               throws Exception
        Creates and returns a new Plugin instance. Implementations are responsible for all necessary setup, including potentially loading the WASM module and configuring it using builder(com.dylibso.chicory.wasm.WasmModule).
        Returns:
        A newly created Plugin instance.
        Throws:
        Exception - If any error occurs during plugin creation (e.g., file loading, WASM instantiation, initialization errors within the plugin's start lifecycle).
      • name

        String name()
        Returns the configured name of the plugin.
        Returns:
        the plugin name.
      • shared

        boolean shared()
        Indicates whether this plugin instance is shared across multiple contexts or requests.

        If true, the plugin will be instantiated once and reused, allowing it to maintain state between requests but potentially introducing contention. If false, a new instance will be created for each request or context, providing better isolation but consuming more memory.

        Returns:
        true if the plugin instance is shared, false otherwise.