Skip to content

Commit

Permalink
Revert "Call listener synchronously, but outside synchronized"
Browse files Browse the repository at this point in the history
This reverts commit 75242cf.
  • Loading branch information
Vlatombe committed Aug 28, 2024
1 parent 75242cf commit ed93ad0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,6 @@ public final long getDemandStartMilliseconds() {
*/
protected void removeExecutor(final Executor e) {
final Runnable task = () -> {
var idle = false;
synchronized (Computer.this) {
executors.remove(e);
oneOffExecutors.remove(e);
Expand All @@ -1105,13 +1104,10 @@ protected void removeExecutor(final Executor e) {
if (ciBase != null) { // TODO confirm safe to assume non-null and use getInstance()
ciBase.removeComputer(Computer.this);
}
} else {
idle = isIdle();
} else if (isIdle()) {
threadPoolForRemoting.submit(() -> Listeners.notify(ComputerListener.class, false, l -> l.onIdle(this)));
}
}
if (idle) {
Listeners.notify(ComputerListener.class, false, l -> l.onIdle(this));
}
};
if (!Queue.tryWithLock(task)) {
// JENKINS-28840 if we couldn't get the lock push the operation to a separate thread to avoid deadlocks
Expand Down

0 comments on commit ed93ad0

Please sign in to comment.