Skip to content

Commit

Permalink
EC2RetentionStrategy - move initialization of clock to readResolve
Browse files Browse the repository at this point in the history
  • Loading branch information
tommywo committed May 28, 2019
1 parent d49078e commit 4973e9f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public EC2RetentionStrategy(String idleTerminationMinutes) {

this.idleTerminationMinutes = value;
}
this.clock = Clock.systemUTC();
}


Expand All @@ -107,9 +106,6 @@ 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 Expand Up @@ -238,6 +234,7 @@ public String getDisplayName() {

protected Object readResolve() {
checkLock = new ReentrantLock(false);
clock = Clock.systemUTC();
return this;
}

Expand Down

0 comments on commit 4973e9f

Please sign in to comment.