Class DefaultQueueHandler

  • All Implemented Interfaces:
    java.lang.Runnable, Fiber, PausableFiber, NotifdQueueHandler

    public class DefaultQueueHandler
    extends java.lang.Object
    implements NotifdQueueHandler
    This class is used as a thread for executing notices for events that are discovered by the notice daemon. The notices are read from an scheduler queue and the processes are created by the fiber. Each created process is added to garbage collection list that is periodically polled and culled based upon the status of the process or how long the process is run. If the process has run long than allocated it is terminated during collection.
    Author:
    Jason Johns,
    • Constructor Detail

      • DefaultQueueHandler

        public DefaultQueueHandler()

        Constructor for DefaultQueueHandler.

    • Method Detail

      • setQueueID

        public void setQueueID​(java.lang.String queueID)

        setQueueID

        Specified by:
        setQueueID in interface NotifdQueueHandler
        Parameters:
        queueID - a String object.
      • setInterval

        public void setInterval​(java.lang.String interval)

        setInterval

        Specified by:
        setInterval in interface NotifdQueueHandler
        Parameters:
        interval - a String object.
      • 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 java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.IllegalStateException - Thrown if the fiber is stopped or has never run.
      • getName

        public java.lang.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