Skip to content

Commit

Permalink
fix for java.lang.UnsupportedOperationException
Browse files Browse the repository at this point in the history
  • Loading branch information
tommywo committed May 27, 2019
1 parent bbda0dc commit d49078e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class EC2RetentionStrategy extends RetentionStrategy<EC2Computer> impleme
public static final boolean DISABLED = Boolean.getBoolean(EC2RetentionStrategy.class.getName() + ".disabled");

private long nextCheckAfter = -1;
private Clock clock;
private transient Clock clock;

/**
* Number of minutes of idleness before an instance should be terminated. A value of zero indicates that the
Expand Down Expand Up @@ -107,6 +107,9 @@ public long check(EC2Computer c) {
return 1;
} else {
try {
if (this.clock == null){
this.clock = Clock.systemUTC();
}
long currentTime = this.clock.millis();

if (currentTime > nextCheckAfter) {
Expand Down

0 comments on commit d49078e

Please sign in to comment.