Interface Root.Controller

  • All Known Implementing Classes:
    AbstractRoot.Controller
    Enclosing interface:
    Root

    public static interface Root.Controller
    An interface used by the RootHub to control the lifecycle of, and communicate with, the Root.
    • Method Detail

      • submitPacket

        boolean submitPacket​(Packet packet)
        Deliver a Packet to this Root. This method is intended to be called from a thread other than the primary thread of the Root. It will add the packet to a queue and return immediately - this method will never block as it may be called from the thread of another Root. This method will return true if the Packet can be handled (see eg. BlockingQueue::offer)
        Parameters:
        packet - message (see Packet / Call) to handle
        Returns:
        true if the packet can be handled
      • start

        void start​(ThreadFactory threadFactory)
        Start the Root. If the Root implementation requires a primary thread to run on it will use the supplied ThreadFactory so that the RootHub can manage thread creation. The ThreadFactory is not required to support the creation of more than one Thread. Controller implementations will ensure that this method can only be invoked once.
        Parameters:
        threadFactory - used if the Root requires a thread to run on.
        Throws:
        IllegalStateException - if the Root has already been started.
      • shutdown

        void shutdown()
        Signal the Root to be shutdown. This method is intended to be called asynchronously and will return immediately - it will not wait for the Root to actually complete execution.