Alex Rivera | Logout

How to kill a Thread in Java that is in state RUNNING?

Asked 2011-11-18T10:08:36.020
10

It is possible to kill a thread that is in state RUNNING in a non programatically way?

I know that top command in *nix can show threads. Can I kill the thread in the OS?

I'd like to know if there is a way to link a thread to a process so I can kill only that specific thread and not the application.

We had a bug in our code that kept a thread in state RUNNING in a synchronized method. The thread kept the lock on the object "hanging" the application.

The bug is fixed. But I wonder if is possible.

Edit
Report

1 Answer

1

On linux, there is a tkill(int tid, int sig) command, similar to kill.

On windows, ProcessExplorer can do it from gui, don't know if there is anything with cli.

answered 2011-11-18T10:31:29.637

Your Answer