Class JobQueue<T extends Job>


  • public class JobQueue<T extends Job>
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(T job)  
      T get()
      Returns the most important entry from this queue.
      T get​(int maxAssigned)
      Returns the most important entry from this queue.
      void interrupt()  
      void notifyWorkers()  
      void remove​(T job)  
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • add

        public void add​(T job)
      • get

        public T get()
              throws java.lang.InterruptedException
        Returns the most important entry from this queue. The method blocks while this queue is empty.
        Throws:
        java.lang.InterruptedException
      • get

        public T get​(int maxAssigned)
              throws java.lang.InterruptedException
        Returns the most important entry from this queue. The method blocks while this queue is empty or while there are already a certain number of jobs assigned.
        Parameters:
        maxAssigned - the maximum number of jobs that should be assigned at any one point. If there are already so many jobs assigned, the queue will block. This is to ensure that the scheduling will continue to work.
        Throws:
        java.lang.InterruptedException
      • interrupt

        public void interrupt()
      • notifyWorkers

        public void notifyWorkers()
      • remove

        public void remove​(T job)
      • size

        public int size()
        Returns:
        the current number of entries in this queue.