Simple tool to attach to a Java VM and kill an individual thread.
Command-line tool to kill a single thread in a Java VM, using the Oracle JDK 6+ Attach API.
Download jkillthread-1.0.jar
and run using the java
command from a JDK to get usage instructions.
Essentially you pass a process ID (or unique name substring) and then a thread name (or substring):
java -jar jkillthread-1.0.jar 12345 "rogue HTTP handler"
(jps -lm
is useful for finding a process ID. jstack 12345
can be used to see currently running threads.)
Beware that killing a thread in Java (Thread.stop
) can have various effects, depending on what it was doing:
stop
.Caveat interfector!