We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Killing a thread

krizmotlhala
krizmotlhala asked
on
Medium Priority
333 Views
Last Modified: 2010-03-31
Can you please help me with a code for killing a thread.
Comment
Watch Question

Top Expert 2004
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Top Expert 2004

Commented:
If the thread is created by your Java program.
CERTIFIED EXPERT
Top Expert 2016

Commented:
What is the thread doing when you want to stop it?
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
a thread is killed when its run() method completes.
the example posted by  twobitadder shows a method for achieving that.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Top Expert 2004

Commented:
>> This won't alone help you in killing the thread.
You code is totally illogic, mmuruganandam. Why do you interrupt the thread when the thread is already interrupted ??

Don't say that thread.interrupt(); won't help until you test it.


If that code is ilogic, the orielly is totally wrong.  Some of the projects that are running with this code not running at all.

Professionalism is much more important in this kind of forums.
Read the words that are used by me and you.

Top Expert 2004

Commented:
>> Professionalism is much more important in this kind of forums.
I'm sorry if you misundertood my comment, i hope you would excuse me.
I only wanted to know why.

no harms webstrom!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.