MCPcopy Create free account
hub / github.com/dorkbox/SystemTray / shutdown

Method shutdown

src/dorkbox/systemTray/util/EventDispatch.java:75–99  ·  view source on GitHub ↗

Shutdown the event dispatch at the end of our current dispatch queue

()

Source from the content-addressed store, hash-verified

73 * Shutdown the event dispatch at the end of our current dispatch queue
74 */
75 public static
76 void shutdown() {
77 // we have to make sure we shut down on our own thread (and not the JavaFX/SWT/AWT/etc thread)
78 runLater(()->{
79 ExecutorService executorService = null;
80 synchronized (EventDispatch.class) {
81 executorService = eventDispatchExecutor;
82 eventDispatchExecutor = null;
83 }
84
85 if (executorService != null) {
86 final List<Runnable> runnables = executorService.shutdownNow();
87 for (int i = 0; i < runnables.size(); i++) {
88 try {
89 runnables.get(i)
90 .run();
91 } catch (Exception e) {
92 SystemTray.logger.error("Error shutting down EventDispatch", e);
93 }
94 }
95
96 shutdownLatch.countDown();
97 }
98 });
99 }
100
101 /**
102 * Waits for the event dispatch to finish shutting down

Callers 1

getMethod · 0.95

Calls 3

runLaterMethod · 0.95
runMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected