Reputation: 31
I have declared variable -Xmx
2 times in JAVA_OPTS in run.sh of JBoss server.
e.g. -Xmx512m
at say line no 15
and -Xmx1024
at say line no 50
So which -Xmx will be actually used by server? And how to check it?
Environment :
Application Server : JBoss 4.2
OS : Linux
Upvotes: 1
Views: 230
Reputation: 68905
It's shell script after all (run.sh
). Most recent value is picked up. You can try it for yourself.
Create a file run.sh
with following content
#!/bin/bash
JAVA_OPTS="Before"
JAVA_OPTS="After"
echo $JAVA_OPTS
and run it ./run.sh
and you should get "After" in the console. Nothing JBoss specific.
So to answer your question -Xmx1024
will be picked up. And to answer your question so as to how to check you can use programs like jconsole
to view your java process and check your maximum memory allocated (as you have provided in -Xmx option). You can also do something like ps -ax | grep java
to see the Java process and the JAVA_OPTS it used.
Upvotes: 1