@Override @GuardedBy("hudson.model.Queue.lock") public long check(T c) { if (!c.isConnecting() && c.isAcceptingTasks()) { if (isIdleForTooLong(c)) { try { Node n = c.getNode(); if (n!=null) // rare, but n==null if the node is deleted and being checked roughly at the same time kill(n); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+c.getDisplayName(),e); } } } return checkCycle(); }
/** * When do we check again next time? */ protected long checkCycle() { return getIdleMaxTime()/10; }
@Override @GuardedBy("hudson.model.Queue.lock") public long check(T c) { if (!c.isConnecting() && c.isAcceptingTasks()) { if (isIdleForTooLong(c)) { try { Node n = c.getNode(); if (n!=null) // rare, but n==null if the node is deleted and being checked roughly at the same time kill(n); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+c.getDisplayName(),e); } } } return checkCycle(); }
/** * Has this computer been idle for too long? */ protected boolean isIdleForTooLong(T c) { return System.currentTimeMillis()-c.getIdleStartMilliseconds() > getIdleMaxTime(); }
/** * When do we check again next time? */ protected long checkCycle() { return getIdleMaxTime()/10; }
/** * Has this computer been idle for too long? */ protected boolean isIdleForTooLong(T c) { return System.currentTimeMillis()-c.getIdleStartMilliseconds() > getIdleMaxTime(); }