Try/catch inside the while
@@ -138,12 +138,14 @@ public class NodeAgentImpl implements NodeAgent {
this.healthChecker = healthChecker;
this.loopThread = new Thread(() -> {
+ while (!terminated.get()) {
try {
- while (!terminated.get()) tick();
+ tick();
} catch (Throwable t) {
numberOfUnhandledException++;
context.log(logger, LogLevel.ERROR, "Unhandled throwable, ignoring", t);
}
+ }
});
this.loopThread.setName("tick-" + context.hostname());
