Avoid negative sleep time in startupServiceStatusCheck
@@ -342,8 +342,8 @@ public class HelixServerStarter {
throw new IllegalStateException("Service status is BAD");
}
long sleepTimeMs = Math.min(checkIntervalMs, endTimeMs - currentTimeMs);
- LOGGER.info("Sleep for {}ms as service status has not turned GOOD: {}", sleepTimeMs,
- ServiceStatus.getStatusDescription());
+ if (sleepTimeMs > 0) {
+ LOGGER.info("Sleep for {}ms as service status has not turned GOOD: {}", sleepTimeMs, ServiceStatus.getStatusDescription());
try {
Thread.sleep(sleepTimeMs);
} catch (InterruptedException e) {
@@ -352,6 +352,7 @@ public class HelixServerStarter {
break;
}
}
+ }
LOGGER.warn("Service status has not turned GOOD within {}ms: {}", System.currentTimeMillis() - startTimeMs,
ServiceStatus.getStatusDescription());
