ronfulkerson
1/7/2016 - 10:30 PM

Java Notes

Java and JVM notes

-XX:OnOutOfMemoryError=kill -9 %p
SETUP JAVA VM:
 
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=1234 -Dcom.sun.management.jmxremote.ssl=false  -Dcom.sun.management.jmxremote.authenticate=false
 
TO ACCESS A HOST BEHIND A FIREWALL (BUT WITH SSH ACCCESS):
 
#CREATE A SOCKS PROXY:
ssh -D 61444 <ssh-accessible-host>
 
#CREATE PROXY SETTINGS IN VISUAL VM:
VisualVM -> Tools -> Options -> Network -> Select Manual Proxy Settings -> localhost:61444
 
ADD THE REMOTE HOST
# Get thread pid using htop
htop -> F4 (filter) -> Input java -> Toggle threads if needed (H) -> Get the thread pid
 
# Thread dump java process
kill -3 <pid>
 
# Identify the bad thread (substitute log file for actual output)
cat var/data/karaf.out | grep -A 10 0x$(printf "%x" <pid>)