tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Renato Weiner <rewei...@yahoo.com>
Subject Re: Killing endless loop servlet - howto ? killing JVM or unload class ?
Date Thu, 12 Jul 2001 13:18:09 GMT

 Can we register the running thread in the service() method of the ServletWrapper object and
then call a thread.interrupt() in the servlet.destroy method ? So we could stop the thread
where unloading the context. Should this do the work ? 
  Roland Carlsson <roland.c@swetravel.se> wrote: 
----- Original Message ----- 
From: "Endre Stølsvik" 
To: 
Sent: Thursday, July 12, 2001 10:50 AM
Subject: Re: Killing endless loop servlet - howto ? killing JVM or unload class ?


> On Thu, 12 Jul 2001, Dmitri Colebatch wrote:
> 
> | On Thu, 12 Jul 2001 16:28, you wrote:
> | > I thought the problem with threads was that you actually _cannot_ kill
> | > them, even "in Java". I find this stupid, and hope I'm wrong! But
> | > apparently you can only "ask" the thread to interrupt and check for status
> | > by using the thread.interrupt(), and isInterrupted() inside the thread.
> | The purpose of this is to force a two-phase termination, and give the thread
> | a chance to clean up... its up to the thread programmer to be aware of any
> | requests for interruption. When you say you can only "ask", you are correct.
> | I dont see why this prohibits my earlier suggestion though...
> 
> How would you stop this thread?
> 
> while(true);
> 
> 
> -- 
> Mvh,
> Endre
> 

Hi!

public booelan running;


public void run(){
while(running){
}
}

Another thread can then stop the thread by altering running to false. Then the thread will
have the possibility to clean after itself.

You must ofcourse register the tread somewhere so you can find it but that is another question.
Perhpas something to implement at serverlevel so a admin can look for running threads and
kill them off...????

Regards
Roland Carlsson





---------------------------------
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 a year!
http://personal.mail.yahoo.com/
Mime
View raw message