public boolean processTasks(){
  boolean result=false;
  Runnable task;
  while ((task=tasks.poll()) != null) {
    result=true;
    task.run();
  }
  return result;
}

public boolean processTasks ( ) { boolean result = false ; Runnable task ; while ( ( task = tasks . poll ( ) ) != null ) { result = true ; task . run ( ) ; } return result ; }
executes all tasks . returns true , if at least one task was executed .
