Skip to content

Commit

Permalink
Merge pull request #9673 from Vlatombe/computerListener.onIdle
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe committed Sep 9, 2024
2 parents c05d756 + 6b88bfc commit b56e5d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,8 @@ protected void removeExecutor(final Executor e) {
if (ciBase != null) { // TODO confirm safe to assume non-null and use getInstance()
ciBase.removeComputer(Computer.this);
}
} else if (isIdle()) {
threadPoolForRemoting.submit(() -> Listeners.notify(ComputerListener.class, false, l -> l.onIdle(this)));
}
}
};
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/java/hudson/slaves/ComputerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ public void onTemporarilyOffline(Computer c, OfflineCause cause) {}
*/
public void onConfigurationChange() {}

/**
* Indicates that the computer has become idle.
*
* @since TODO
*/
public void onIdle(Computer c) {}

/**
* Registers this {@link ComputerListener} so that it will start receiving events.
*
Expand Down

0 comments on commit b56e5d7

Please sign in to comment.