Class LoadBalancer.Queue

  • Enclosing class:
    LoadBalancer

    public static class LoadBalancer.Queue
    extends Base
    A Queue is used to effeciently queue up items for daemon threads to work on.
    • Field Detail

      • m_list

        protected List m_list
        A list of items that have been queued.
    • Constructor Detail

      • Queue

        public Queue()
        Construct a queue.
    • Method Detail

      • size

        public int size()
        Determine the number of items in the queue.
        Returns:
        the number of items in the queue
      • isEmpty

        public boolean isEmpty()
        Determine if the queue is empty.
        Returns:
        true if the queue currently has no items in it
      • add

        public void add​(Object o)
        Add an object to the end of the queue.
        Parameters:
        o - the item to add to the end of the queue
      • remove

        public Object remove()
                      throws InterruptedException
        Wait for and remove an item from the from of the queue.
        Returns:
        an item from the queue
        Throws:
        InterruptedException - if the thread is interrupted while waiting for something to be added to the queue
      • removeNoWait

        public Object removeNoWait()
        Remove an item from the queue if the queue is not empty.
        Returns:
        an item if the queue is not empty, otherwise null