Kill Thread Within Java.exe Process

J

John A. Bailo

I am monitoring a java application (running as a Windows service) from
a third party.

psinfo shows me all threads, and I noticed there were two that have
been running over 9 hours. It was about 9 hours ago that CPU
utilization on my Windows 2000 Server went up to 50%.

I know I use pskill to stop the entire java.exe -- but is there an
external command or program I can write to kill an individual thread
inside a java.exe ?
 
D

Daniel Pitts

I am monitoring a java application (running as a Windows service) from
a third party.

psinfo shows me all threads, and I noticed there were two that have
been running over 9 hours. It was about 9 hours ago that CPU
utilization on my Windows 2000 Server went up to 50%.

I know I use pskill to stop the entire java.exe -- but is there an
external command or program I can write to kill an individual thread
inside a java.exe ?

No. You'll have stop the entire Java proces and start it again.
 
E

Eric Sosman

John said:
I am monitoring a java application (running as a Windows service) from
a third party.

psinfo shows me all threads, and I noticed there were two that have
been running over 9 hours. It was about 9 hours ago that CPU
utilization on my Windows 2000 Server went up to 50%.

I know I use pskill to stop the entire java.exe -- but is there an
external command or program I can write to kill an individual thread
inside a java.exe ?

Not unless you've arranged a way for the threads to stop
on (or shortly after) some external stimulus.

See the Javadoc for Thread#stop() to understand why this
cannot even be done safely from inside the Java program, much
less from the outside.
 
M

Mike Schilling

Eric said:
Not unless you've arranged a way for the threads to stop
on (or shortly after) some external stimulus.

One way of doing this to to run the JVM as debuggable. That lets you attach
a debugger later, examine the threads, and kill whichever ones you like.
See the Javadoc for Thread#stop() to understand why this
cannot even be done safely from inside the Java program, much
less from the outside.

That's true, of course.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top