Merge pull request #1 from gmbrax/fix/fix-continous-run

Improve shutdown hook and application lifecycle logging:
This commit is contained in:
Gustavo Henrique Miranda 2025-11-13 05:47:47 -03:00 committed by GitHub
commit 8c291867ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -29,7 +29,23 @@ public class MediaManagerApplication {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
logger.info("Shutting down MediaManager Core...");
// 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) {
logger.error("Failed to start MediaManager Core", e);