mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-29 09:05:53 +00:00
HER-2065 - in activateInactiveQueue() close synchronized block earlier, and move updateHighestWaiting() up to keep it inside the block; now the call to deactivateQueue() is not in the synchronized block, so the deadlock should be avoided (fix suggested by kenji)
This commit is contained in:
@@ -764,32 +764,33 @@ implements Closeable,
|
||||
Queue<String> queueOfWorkQueueKeys = entry.getValue();
|
||||
|
||||
while (true) {
|
||||
String workQueueKey;
|
||||
synchronized (getInactiveQueuesByPrecedence()) {
|
||||
String workQueueKey = queueOfWorkQueueKeys.poll();
|
||||
workQueueKey = queueOfWorkQueueKeys.poll();
|
||||
if (workQueueKey == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
WorkQueue candidateQ = (WorkQueue) this.allQueues.get(workQueueKey);
|
||||
if (candidateQ.getPrecedence() > expectedPrecedence) {
|
||||
// queue demoted since placed; re-deactivate
|
||||
deactivateQueue(candidateQ);
|
||||
candidateQ.makeDirty();
|
||||
continue;
|
||||
}
|
||||
|
||||
updateHighestWaiting(expectedPrecedence);
|
||||
try {
|
||||
readyClassQueues.put(workQueueKey);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
WorkQueue candidateQ = (WorkQueue) this.allQueues.get(workQueueKey);
|
||||
if (candidateQ.getPrecedence() > expectedPrecedence) {
|
||||
// queue demoted since placed; re-deactivate
|
||||
deactivateQueue(candidateQ);
|
||||
candidateQ.makeDirty();
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
readyClassQueues.put(workQueueKey);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user