Class QueServer

  • All Implemented Interfaces:
    IPausable, Runnable
    Direct Known Subclasses:
    FilePickUpClient.FileQueServer

    public abstract class QueServer
    extends Pausable
    Monitor thread for a PickupQueue and return items for processing. Operates in pull mode from a PickupSpace or push mode just monitoring the queue
    • Field Detail

      • DEFAULT_POLLING_INTERVAL

        public static final long DEFAULT_POLLING_INTERVAL
        See Also:
        Constant Field Values
      • pollingInterval

        protected long pollingInterval
      • timeToShutdown

        protected boolean timeToShutdown
    • Constructor Detail

      • QueServer

        public QueServer​(IPickUpSpace space,
                         PickupQueue queue)
        Create
        Parameters:
        space - the pickupspace controller
        queue - the queue this thread monitors
      • QueServer

        public QueServer​(IPickUpSpace space,
                         PickupQueue queue,
                         long pollingInterval)
        Create with polling interval
        Parameters:
        space - the pickupspace controller
        queue - the queue this thread monitors
        pollingInterval - value in millis
      • QueServer

        public QueServer​(IPickUpSpace space,
                         PickupQueue queue,
                         long pollingInterval,
                         String name)
        Create with polling interval and thread name
        Parameters:
        space - the pickupspace controller
        queue - the queue this thread monitors
        pollingInterval - value in millis
        name - value to supply to Thread name
    • Method Detail

      • run

        public void run()
        Processing loop to monitor the queue
        Specified by:
        run in interface Runnable
        Specified by:
        run in class Pausable
      • checkQue

        public void checkQue()
        Check the queue for waiting objects and process them
      • processQueueItem

        public abstract boolean processQueueItem​(WorkBundle path)
        Action to take when an item is removed from queue
        Parameters:
        path - the bundle from the queue
        Returns:
        true if it worked
      • shutdown

        public void shutdown()
        Schedule this thread to stop soon
      • getQueSize

        public int getQueSize()
        Pass through to get size of injected queue
        Returns:
        size of the queue
      • enque

        public boolean enque​(WorkBundle bundle)
        Pass through to enqueue a work bundle on the injected queue
        Parameters:
        bundle - the work bundle to enqueue
        Returns:
        true if it was enqueued, false if we are too busy to handle it