From 995ca2382cec2c3df6c9eb099db05ed3b0624835 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 18 May 2008 22:03:19 +0000 Subject: [PATCH] simplified by using a convenience method. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9401 71c3de6d-444a-0410-be80-ed276b4c234a --- .../java/hudson/slaves/SlaveReconnectionWork.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/hudson/slaves/SlaveReconnectionWork.java b/core/src/main/java/hudson/slaves/SlaveReconnectionWork.java index d0f46b2921..9aca9d4c52 100644 --- a/core/src/main/java/hudson/slaves/SlaveReconnectionWork.java +++ b/core/src/main/java/hudson/slaves/SlaveReconnectionWork.java @@ -1,9 +1,8 @@ package hudson.slaves; -import hudson.model.Slave; import hudson.model.Hudson; import hudson.model.Queue; -import hudson.model.Executor; +import hudson.model.Slave; import hudson.triggers.SafeTimerTask; import java.util.Map; @@ -25,13 +24,8 @@ public class SlaveReconnectionWork extends SafeTimerTask { for (Slave s : Hudson.getInstance().getSlaves()) { if (!nextCheck.containsKey(s) || System.currentTimeMillis() > nextCheck.get(s)) { - boolean hasJob = false; - for (Executor exec: s.getComputer().getExecutors()) { - if (!exec.isIdle()) { - hasJob = true; - break; - } - } + boolean hasJob = !s.getComputer().isIdle(); + // TODO get only the items from the queue that can apply to this slave SlaveAvailabilityStrategy.State state = new SlaveAvailabilityStrategy.State(queue.getItems().length > 0, hasJob); // at the moment I don't trust strategies to wait more than 60 minutes -- GitLab