private List<Runnable> drainQueue(){
  BlockingQueue<Runnable> q=workQueue;
  List<Runnable> taskList=new ArrayList<Runnable>();
  q.drainTo(taskList);
  if (!q.isEmpty()) {
    for (    Runnable r : q.toArray(new Runnable[0])) {
      if (q.remove(r))       taskList.add(r);
    }
  }
  return taskList;
}

private List < Runnable > drainQueue ( ) { BlockingQueue < Runnable > q = workQueue ; List < Runnable > taskList = new ArrayList < Runnable > ( ) ; q . drainTo ( taskList ) ; if ( ! q . isEmpty ( ) ) { for ( Runnable r : q . toArray ( new Runnable [ 0 ] ) ) { if ( q . remove ( r ) ) taskList . add ( r ) ; } } return taskList ; }
drains the task queue into a new list , normally using drainto . but if the queue is a delayqueue or any other kind of queue for which poll or drainto may fail to remove some elements , it deletes them one by one .
