Add log for fatal error when InitExecutor failed
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
a680b4c5e3
commit
6765130f1b
|
|
@ -45,17 +45,21 @@ public final class InitExecutor {
|
||||||
ServiceLoader<InitFunc> loader = ServiceLoader.load(InitFunc.class);
|
ServiceLoader<InitFunc> loader = ServiceLoader.load(InitFunc.class);
|
||||||
List<OrderWrapper> initList = new ArrayList<OrderWrapper>();
|
List<OrderWrapper> initList = new ArrayList<OrderWrapper>();
|
||||||
for (InitFunc initFunc : loader) {
|
for (InitFunc initFunc : loader) {
|
||||||
RecordLog.info("[Sentinel InitExecutor] Found init func: " + initFunc.getClass().getCanonicalName());
|
RecordLog.info("[InitExecutor] Found init func: " + initFunc.getClass().getCanonicalName());
|
||||||
insertSorted(initList, initFunc);
|
insertSorted(initList, initFunc);
|
||||||
}
|
}
|
||||||
for (OrderWrapper w : initList) {
|
for (OrderWrapper w : initList) {
|
||||||
w.func.init();
|
w.func.init();
|
||||||
RecordLog.info(String.format("[Sentinel InitExecutor] Initialized: %s with order %d",
|
RecordLog.info(String.format("[InitExecutor] Initialized: %s with order %d",
|
||||||
w.func.getClass().getCanonicalName(), w.order));
|
w.func.getClass().getCanonicalName(), w.order));
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
RecordLog.info("[Sentinel InitExecutor] Init failed", ex);
|
RecordLog.warn("[InitExecutor] Init failed", ex);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
} catch (Error error) {
|
||||||
|
RecordLog.warn("[InitExecutor] Init failed with fatal error", error);
|
||||||
|
error.printStackTrace();
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue