migrate thread cleanup from server.stopped to runtime hook
This commit is contained in:
1 file changed
+2
-2
@@ -100,9 +100,9 @@ public class JustBackupMod implements ModInitializer {
|
|||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)),
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)),
|
||||||
this::handleFileChanges
|
this::handleFileChanges
|
||||||
);
|
);
|
||||||
ServerLifecycleEvents.SERVER_STOPPED.register(server -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
if (watcherThread.getState() != Thread.State.TERMINATED) watcherThread.interrupt();
|
if (watcherThread.getState() != Thread.State.TERMINATED) watcherThread.interrupt();
|
||||||
});
|
}));
|
||||||
watcherThread.start();
|
watcherThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user