Class DefaultQueueHandler

    • Constructor Detail

      • DefaultQueueHandler

        public DefaultQueueHandler()

        Constructor for DefaultQueueHandler.

    • Method Detail

      • run

        public void run()
        The main worker of the fiber. This method is executed by the encapsulated thread to read commands from the execution queue and to execute those commands. If the thread is interrupted or the status changes to STOP_PENDING then the method will return as quickly as possible.
        Specified by:
        run in interface Runnable
      • start

        public void start()
        Starts the fiber. If the fiber has already been run or is currently running then an exception is generated. The status of the fiber is updated to STARTING and will transition to RUNNING when the fiber finishes initializing and begins processing the encapsulated queue.
        Specified by:
        start in interface Fiber
        Throws:
        IllegalStateException - Thrown if the fiber is stopped or has never run.
      • stop

        public void stop()
        Stops a currently running fiber. If the fiber has already been stopped then the command is silently ignored. If the fiber was never started then an exception is generated.
        Specified by:
        stop in interface Fiber
        Throws:
        IllegalStateException - Thrown if the fiber was never started.
      • pause

        public void pause()
        Pauses a currently running fiber. If the fiber was not in a running or resuming state then the command is silently discarded. If the fiber is not running or has terminated then an exception is generated.
        Specified by:
        pause in interface PausableFiber
        Throws:
        IllegalStateException - Thrown if the fiber is stopped or has never run.
      • resume

        public void resume()
        Resumes the fiber if it is paused. If the fiber was not in a paused or pause pending state then the request is discarded. If the fiber has not been started or has already stopped then an exception is generated.
        Specified by:
        resume in interface PausableFiber
        Throws:
        IllegalStateException - Thrown if the fiber is stopped or has never run.
      • getName

        public String getName()
        Returns the name of this fiber.
        Specified by:
        getName in interface Fiber
        Returns:
        The name of the fiber.
      • getStatus

        public int getStatus()
        Returns the current status of the pausable fiber.
        Specified by:
        getStatus in interface Fiber
        Returns:
        The current status of the fiber.
        See Also:
        PausableFiber, Fiber