mirror of
https://github.com/gmbrax/MediaManager-core.git
synced 2026-11-09 14:00:17 +00:00
Merge pull request #1 from gmbrax/fix/fix-continous-run
Improve shutdown hook and application lifecycle logging:
This commit is contained in:
@@ -29,7 +29,23 @@ public class MediaManagerApplication {
|
|||||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
logger.info("Shutting down MediaManager Core...");
|
logger.info("Shutting down MediaManager Core...");
|
||||||
// TODO: Cleanup resources
|
// TODO: Cleanup resources
|
||||||
|
|
||||||
|
logger.info("MediaManager Core shutdown successfully");
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
logger.info("Application is running");
|
||||||
|
logger.info("Press Ctrl+C to exit");
|
||||||
|
Thread.currentThread().join();
|
||||||
|
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
|
||||||
|
logger.info("Application interrupted, initiating shutdown...");
|
||||||
|
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to start MediaManager Core", e);
|
logger.error("Failed to start MediaManager Core", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user