Permalink
Browse files

Merge pull request #1960 from varmenise/IdleOfflineCause-ClassImpleme…

…ntation

create a specific implementation for Idle Offline Cause
  • Loading branch information...
varmenise committed Jan 4, 2016
2 parents 9ab3f1d + e516d6e commit 7e05b5032e138b5780eabc790d7cddecdc9b0b7c
@@ -155,4 +155,14 @@ public ByCLI(String message) {
this.message = message;
}
}
/**
* Caused by idle period.
* @since TODO
*/
public static class IdleOfflineCause extends SimpleOfflineCause {
public IdleOfflineCause () {
super(hudson.slaves.Messages._RetentionStrategy_Demand_OfflineIdle());
}
}
}
@@ -267,7 +267,7 @@ public long check(final SlaveComputer c) {
// we've been idle for long enough
logger.log(Level.INFO, "Disconnecting computer {0} as it has been idle for {1}",
new Object[]{c.getName(), Util.getTimeSpanString(idleMilliseconds)});
c.disconnect(OfflineCause.create(Messages._RetentionStrategy_Demand_OfflineIdle()));
c.disconnect(new OfflineCause.IdleOfflineCause());
} else {
// no point revisiting until we can be confident we will be idle
return TimeUnit.MILLISECONDS.toMinutes(TimeUnit.MINUTES.toMillis(idleDelay) - idleMilliseconds);

0 comments on commit 7e05b50

Please sign in to comment.