starting threads from servlets
- From: fernandomirandamuro@xxxxxxxxx (Fernando)
- Date: 29 Apr 2005 05:37:32 -0700
Hi,
i have a problem, i need to start a thread form a servlet, so that it
keeps running in background, checking some values in DB every minute.
The problem is that i start the thread from the servlet and firefox
tab seems to be loading all the time, not allowing me to click on
other links from the jsp page, because when i do so the thread is
interrupted.
I've tried to create another class which starts the thread, and call
it from the servlet, but it's the same story.
The thread should keep executing itself with this loop inside start:
public synchronized void start() {
while(true) {
try {
verificar();//checks something
sleep(60000);
} catch (InterruptedException e) {
//?
}
}
}
I'm not sure if i'm aproaching this from the right view. if i want the
thread to be always running, is this the right thing to do? and how
should i start the thread from the servlet?
Thanks.
.
- Follow-Ups:
- Re: starting threads from servlets
- From: Ross Bamford
- Re: starting threads from servlets
- From: Thomas Schodt
- Re: starting threads from servlets
- From: Lee Ryman
- Re: starting threads from servlets
- Prev by Date: Re: Force java applet to run on java microsoft virtual machine plugin and not Sun.
- Next by Date: Re: blocking calls in java
- Previous by thread: blocking calls in java
- Next by thread: Re: starting threads from servlets
- Index(es):
Relevant Pages
|