How can we kill the running thread in java?
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   karthikeyan_krishnamoorty
Posted On:   Thursday, October 6, 2005 08:11 AM

my requirment is , i want to kill perticular thread.
can any one help me out how to this?

Re: How can we kill the running thread in java?

Posted By:   siva_k  
Posted On:   Friday, October 21, 2005 06:48 AM

Make a thread to dead state....

Re: How can we kill the running thread in java?

Posted By:   srini_vasan  
Posted On:   Wednesday, October 12, 2005 06:24 AM

Hi,




u can kill the partictular thread by setting external
class varaiable.

  
Class Outer
{
public static flag=true;

Outer()
{
new Test().start();
}
class Test extends Thread
{

public void run()
{
while(Outer.flag)
{
//do ur work here
}
}
}

}

if u want to stop the above thread ,
set flag variable as false.




The another way to kill a thread is

just register ur thread with ThreadGroup.


and use the method destroy() of ThreadGroup.

and this way is also used kill similar threads by
creating them as group or register with group.



thanks,

srini

Re: How can we kill the running thread in java?

Posted By:   Anonymous  
Posted On:   Friday, October 7, 2005 05:18 AM

http://forum.java.sun.com/thread.jspa?threadID=638398&messageID=3736553


--------------------

Jeff Parker

www.devsquare.com

DevSquare - Online Application Development
About | Sitemap | Contact