/** Blocks until a free slot appears in the thread queue. */
protected void waitForFreeQueueSlot() {
final ThreadPoolMonitor monitor = new ThreadPoolMonitor();
synchronized (monitor) {
threadPool.submit(monitor);
monitor.watch();
}
}
/**
* Callback for adding reduce tasks to the run queue.