자바 vm 은 몇 가지 signal에 대해 동작이 정의되어 있다.(http://www.oracle.com/technetwork/java/javase/signals-139944.html#gbzbl)

Signal
Description
SIGSEGV, SIGBUS, SIGFPE,SIGPIPE, SIGILL
Used in the implementation for implicit null check, and so forth.
SIGQUIT
Thread dump support: To dump Java stack traces at the standard error stream. (Optional.)
SIGTERM, SIGINT, SIGHUP
Used to support the shutdown hook mechanism (java.lang.Runtime.addShutdownHook) when the VM is terminated abnormally. (Optional.)
SIGUSR1
Used in the implementation of thejava.lang.Thread.interrupt method. (Configurable.) Not used starting with Solaris 10 OS. Reserved on Linux.
SIGUSR2
Used internally. (Configurable.) Not used starting with Solaris 10 OS.
SIGABRT
The HotSpot VM does not handle this signal. Instead it calls the abort function after fatal error handling. If an application uses this signal then it should terminate the process to preserve the expected semantics.

시그널 발생은 kill 명령어를 사용하면 되며 이중에 QUIT 시그널을 Java VM 에 전송하면 VM 내 thread dump 와 stack trace 를 실행하므로 WAS 가 제대로 shutdown 이 안 되거나 VM 이 hang 걸렸을 때 원인을 찾기 위한 디버깅에 유용하게 사용할  수 있다.

 

사용법

kill -QUIT pid_num
CODE

pid_num 는 자바 VM 의 pid 를 적어주면 된다.

개인적으로는 kill 명령어뒤에 9, 3 같은 시그널 숫자를 넣는 것 보다는 KILL, QUIT 같은 문자열을 넣는게 기억하기 쉬워서 선호하는 편이다.

 

같이 보기