protected void putJobImpl ( Executable job ) { JobItem posted = new JobItem ( job ) ; if ( m_currentJob == null ) { // The queue is empty, set the current job to process and // wake up the thread waiting in method getJob m_currentJob = posted ; notifyAll ( ) ; } else { JobItem item = m_currentJob ; // The queue is not empty, find the end of the queue ad add the // posted job at the end while ( item . m_next != null ) { item = item . m_next ; } item . m_next = posted ; } }
Never call this method only override in subclasses to perform job adding in a specific way normally tied to the data structure holding the jobs .