MCPcopy Create free account
hub / github.com/e2wugui/zeze / run

Method run

ZezeJava/ZezeJava/src/main/java/Zeze/Util/ShutdownHook.java:17–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 static {
16 Runtime.getRuntime().addShutdownHook(new Thread("ShutdownHook") {
17 @SuppressWarnings("unchecked")
18 @Override
19 public void run() {
20 logger.info("ShutdownHook begin");
21 Map.Entry<Object, Action0>[] entries;
22 shutdownActionsLock.lock();
23 try {
24 entries = shutdownActions.entrySet().toArray(new Map.Entry[shutdownActions.size()]);
25 } finally {
26 shutdownActionsLock.unlock();
27 }
28 for (int i = entries.length - 1; i >= 0; i--) { // 按add的逆序执行各action
29 var entry = entries[i];
30 try {
31 entry.getValue().run();
32 } catch (Throwable e) { // run handle.
33 logger.error("action({}).run exception:", entry.getKey(), e);
34 }
35 }
36 logger.info("ShutdownHook end");
37 LogManager.shutdown();
38 }
39 });
40 }
41

Callers

nothing calls this directly

Calls 9

lockMethod · 0.65
sizeMethod · 0.65
unlockMethod · 0.65
runMethod · 0.65
getValueMethod · 0.65
getKeyMethod · 0.65
toArrayMethod · 0.45
entrySetMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected