Merge pull request #1 from gmbrax/fix/fix-continous-run
Improve shutdown hook and application lifecycle logging:
This commit is contained in:
commit
8c291867ce
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue