private synchronized void tryAssignTask() {
if (this.tasks.isEmpty())
return;
DereferencingTask task = (DereferencingTask) this.tasks.getFirst();
Iterator<DereferencerThread> it = this.threads.iterator();
while (it.hasNext()) {
DereferencerThread thread = it.next();
if (thread.startDereferencingIfAvailable(task)) {
this.tasks.removeFirst();
this.log.debug("Dequeue: <" + task.getURI() + ">@" + task.getStep() +
" (n = " + this.tasks.size() + ")");
break;
}
}
}