forked from Luke-Sikina/picsure-search-refinement
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ALS-7751] Java Opts can now be passed to docker container (#52)
* Add MemoryCheck service for monitoring max heap memory * Replace System.out with SLF4J logger in MemoryCheck Updated the MemoryCheck class to use SLF4J logger instead of System.out for logging max heap memory. This enhances logging consistency and allows better integration with logging frameworks.
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/edu/harvard/dbmi/avillach/dictionary/memory/MemoryCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package edu.harvard.dbmi.avillach.dictionary.memory; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class MemoryCheck { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(MemoryCheck.class); | ||
|
||
@PostConstruct | ||
public void checkMemory() { | ||
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024); | ||
LOG.info("Max Heap Memory (Xmx): {} MB", maxMemory); | ||
} | ||
|
||
} |