Introduce initialization exception handler in KCL V2 (#369)
Added a new method to the WorkerStateChangeListener that is called once all attempts to initialize the scheduler have failed.
This commit is contained in:
parent
0634a3c836
commit
ea49eef19e
2 changed files with 5 additions and 1 deletions
|
|
@ -207,8 +207,9 @@ public class Scheduler implements Runnable {
|
|||
try {
|
||||
initialize();
|
||||
log.info("Initialization complete. Starting worker loop.");
|
||||
} catch (RuntimeException e) {
|
||||
} catch (RuntimeException e) {
|
||||
log.error("Unable to initialize after {} attempts. Shutting down.", maxInitializationAttempts, e);
|
||||
workerStateChangeListener.onAllInitializationAttemptsFailed(e);
|
||||
shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,4 +27,7 @@ public interface WorkerStateChangeListener {
|
|||
}
|
||||
|
||||
void onWorkerStateChange(WorkerState newState);
|
||||
|
||||
default void onAllInitializationAttemptsFailed(Throwable e) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue