Skip to content

Commit

Permalink
Merge pull request #1960 from varmenise/IdleOfflineCause-ClassImpleme…
Browse files Browse the repository at this point in the history
…ntation

create a specific implementation for Idle Offline Cause
  • Loading branch information
varmenise committed Jan 4, 2016
2 parents 9ab3f1d + e516d6e commit 7e05b50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions core/src/main/java/hudson/slaves/OfflineCause.java
Expand Up @@ -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());
}
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/slaves/RetentionStrategy.java
Expand Up @@ -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);
Expand Down

0 comments on commit 7e05b50

Please sign in to comment.