Class Hub

java.lang.Object
org.praxislive.hub.Hub

public final class Hub extends Object
Support for configuring and running a RootHub, along with the Roots within it.

This class doesn't implement either RootHub or Root directly. It uses a core root, usually an instance or subclass of BasicCoreRoot, to manage other system and user roots.

Use builder() to configure and create an instance of this class.

  • Field Details

  • Method Details

    • start

      public void start() throws Exception
      Start the hub. This will start the core root, which will in turn start other services. A hub cannot be started more than once and is not reusable.
      Throws:
      Exception - if start fails or the hub has already been started
    • shutdown

      public void shutdown()
      Signal the hub to shutdown. This will signal the core root to terminate, which will terminate all other roots.
    • await

      public void await() throws InterruptedException
      Wait for the core root and hub to terminate.
      Throws:
      InterruptedException - if interrupted
    • await

      public void await(long time, TimeUnit unit) throws InterruptedException, TimeoutException
      Wait for the given time period for the core root and hub to terminate.
      Parameters:
      time - time to wait
      unit - unit of time to wait
      Throws:
      InterruptedException - if interrupted
      TimeoutException - if the hub has not terminated in the given time
    • isAlive

      public boolean isAlive()
      Query whether the hub and core root are running.
      Returns:
      true if active
    • exitValue

      public int exitValue()
      Return an exit value for the hub. This may be used as the exit value for the hub process. The default value is 0.
      Returns:
      exit value
    • builder

      public static Hub.Builder builder()
      Create a Hub.Builder.
      Returns:
      builder