mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-09-11 03:35:28 +02:00
Release the background resources a discarded runtime owns
Several resources outlived a disconnect on purpose, which was harmless while a process ran exactly one session for its whole life. They are now released when the controller itself is closed: - the ON4KST connection supervisor thread, which stopByUser did not touch - the sked reminder scheduler, which had no shutdown at all - the reachability executor, whose shutdown method existed but was never called - the PSTRotator retry scheduler and its pending retry - the map tile proxy, whose stop method existed but was never called, leaving a server socket and a twelve thread pool behind - the station map bridge listeners and its coalescing animation, which would otherwise keep firing into a dead user interface These are real leaks today; they only become visible when a second runtime is built in the same process. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hpa6bjie5qkeNG62y6FmXm
This commit is contained in:
@@ -139,6 +139,20 @@ final class On4KstConnectionManager {
|
||||
scheduler.execute(() -> openConnection(token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the supervisor thread of this manager for good.
|
||||
*
|
||||
* <p>{@link #stopByUser()} only ends the current ON4KST session; the periodic
|
||||
* session monitor keeps running. That is correct while the application lives, but a
|
||||
* manager belonging to a discarded runtime must release its thread, otherwise every
|
||||
* operator profile switch would leave another supervisor behind holding the dead
|
||||
* controller.</p>
|
||||
*/
|
||||
void shutdown() {
|
||||
scheduler.shutdownNow();
|
||||
LOGGER.fine("ON4KST connection supervisor shut down");
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the current session and invalidates every scheduled callback or reconnect
|
||||
* belonging to it.
|
||||
|
||||
Reference in New Issue
Block a user