Killing running thread in JBoss

Quick how to, check update to more information. Worked with JBoss 6.1 EAP.

This not work with locked thread.

Checking process PID

jps

Output something like this:

12124 Jps

24541 jboss-modules.jar

Generate DUMP for JBoss Process

jstack 24541 >> /tmp/dump_24042014_1754.txt  # 24541 is JBoss PID

Checking the Thread name

cat /tmp/dump_24042014_1754.txt | grep -i "http-/0.0.0.0:8080-9"

Output something like this:

“http-/0.0.0.0:8080-9” daemon prio=10 tid=0x00007f2ea8094800 nid=0x6073 runnable [0x00007f2e9df10000]

Running JKillThread

java -jar jkillthread-1.0-SNAPSHOT.jar 24541 "http-/0.0.0.0:8080-9"
# 24541 is JBoss PID
# Thread Name is "http-/0.0.0.0:8080-9"

Checking in JBoss log (standalone running mode)

tail -50f /usr/java/jboss-eap-6.2/standalone/log/server.log

Output something like:

24-04-2014 17:56:10,410 ERROR [stderr] (Attach Listener) Killing "http-/0.0.0.0:8080-9"

References and Resources

JKillThread