Fix transient unit test failure in trogdor coordinator shutdown
In the coordinator, we should check that 'shutdown' is not true before going to sleep waiting for the condition.
Author: Colin P. Mccabe
Reviewers: Apurva Mehta Jason Gustafson
Closes from cmccabe/KAFKA-5806
@@ -130,16 +130,19 @@ public final class Coordinator {
List<Fault> toStart = new ArrayList<>();
lock.lock();
try {
+ if (shutdown) {
+ break;
+ }
if (nextWakeMs > now) {
if (cond.await(nextWakeMs - now, TimeUnit.MILLISECONDS)) {
log.trace("CoordinatorRunnable woke up early.");
}
- }
- nextWakeMs = now + (60L * 60L * 1000L);
+ now = time.milliseconds();
if (shutdown) {
- log.info("CoordinatorRunnable shutting down.");
- return;
+ break;
}
+ }
+ nextWakeMs = now + (60L * 60L * 1000L);
Iterator<Fault> iter = pendingFaults.iterateByStart();
while (iter.hasNext()) {
Fault fault = iter.next();
