F
Fernando
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.
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.