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