code: private Runnable getNextTask() {
  		Runnable task = null;
  		synchronized (this.tasks) {
  			if (!this.tasks.isEmpty()) {
  				task = this.tasks.poll();
  				if (this.tasks.isEmpty()) {
  					this.tasks.notifyAll();
  				}
  			}
  		}
  		return task;
  	}
docs: //////////////