Class MediaDriver

java.lang.Object
io.aeron.driver.MediaDriver
All Implemented Interfaces:
AutoCloseable

public final class MediaDriver extends Object implements AutoCloseable
Main class for JVM-based media driver

Usage: $ java -jar aeron-driver.jar $ java -Doption=value -jar aeron-driver.jar

See Also:
  • Method Details

    • main

      public static void main(String[] args)
      Main method for launching the process.
      Parameters:
      args - passed to the process.
    • launchEmbedded

      public static MediaDriver launchEmbedded()
      Launch an isolated MediaDriver embedded in the current process with a generated aeronDirectoryName that can be retrieved by calling aeronDirectoryName.

      If the aeronDirectoryName is set as a system property to something different from CommonContext.AERON_DIR_PROP_DEFAULT then this set value will be used.

      Returns:
      the newly started MediaDriver.
    • launchEmbedded

      public static MediaDriver launchEmbedded(MediaDriver.Context ctx)
      Launch an isolated MediaDriver embedded in the current process with a provided configuration ctx and a generated aeronDirectoryName (overwrites configured CommonContext.aeronDirectoryName()) that can be retrieved by calling aeronDirectoryName.

      If the aeronDirectoryName is set as a system property, or via context, to something different from CommonContext.AERON_DIR_PROP_DEFAULT then this set value will be used.

      Parameters:
      ctx - containing the configuration options.
      Returns:
      the newly started MediaDriver.
    • launch

      public static MediaDriver launch()
      Launch a MediaDriver embedded in the current process with default configuration.
      Returns:
      the newly started MediaDriver.
    • launch

      public static MediaDriver launch(MediaDriver.Context ctx)
      Launch a MediaDriver embedded in the current process and provided a configuration ctx.
      Parameters:
      ctx - containing the configuration options.
      Returns:
      the newly created MediaDriver.
    • context

      public MediaDriver.Context context()
      Get the MediaDriver.Context that is used by this MediaDriver.
      Returns:
      the MediaDriver.Context that is used by this MediaDriver.
    • sharedAgentInvoker

      public AgentInvoker sharedAgentInvoker()
      Get the AgentInvoker for the shared agents when running without threads.
      Returns:
      the AgentInvoker for the shared agents when running without threads.
    • close

      public void close()
      Shutdown the media driver by stopping all threads and freeing resources.
      Specified by:
      close in interface AutoCloseable
    • aeronDirectoryName

      public String aeronDirectoryName()
      Used to access the configured aeronDirectoryName for this MediaDriver, typically used after the launchEmbedded() method is used.
      Returns:
      the context aeronDirectoryName