I am now stuck on problem is that in our application used thread and that start in jsp page. so here problem is once thread started and after completion of run method it goes to dead. we can not restart dead thread.

so whenever goes that jsp page trying to use start thread its not working. for that need to restart the tomcat for starting that thread again.

Here our requirement is whenever we use jsp page on which thread started that thread should come into use.

please give me solution.....

Thanks in advance

6 Years
Discussion Span
Last Post by ck-81

1. Your description is absolutely confusing, you should explain in better way and if possible with some code to demonstrate what you doing
2. You may want to learn more about thread lifecycle (once thread completed task then dies, no chance of recalling it, you have to create new one)

Attachments life-c1.gif 8.75 KB

I have start thread on jsp page by writing following code

here is disAllData is thread.
jsp page is search.jsp

<jsp:useBebean id="dis" class="pagenation.disAllData" scope="session"/>


when above search.jsp execute first time it is working properly.
after first time executing thread goes to dead stat.
and whenever second time I want to execute search.jsp that time also thread should be start.

that means whenever submit above jsp page thread's run method should be called.


pagination is package name and I want to execute run() method of disAllData thread at every time search.jsp executed.


pagination is package name and I want to execute run() method of disAllData thread at every time search.jsp executed.

You did not answer my question what is the purpose af this thread? What job does it?



thread is used for executing query which is taking long time for execution.
here simultaneously doing some another process and after thread dead I use that result in my application.


I can't you did not provided enough info. You just keep talking about call thread on each page access, but you do not provide any relevant code and do not explain what are your intentions (just as you ignored my last question)


I am trying executing long query so its take long execution time.
I want to reduce execution time, so for that long query executing by using thread and that same query executing in small small part and showing the result to user till thread execution completion. after thread execution completed show the result of thread to user.

Thanks for reply.......


Obviously wrong attempt on solution or possible wrong implementation. If you bay any chance work for bank or financial institution I can understand that you may have long query, but then you would use caching and maybe Ajax asynchronous calls.
So you should look on reason why query is taking so long to execute and do a different way of loading data
A) loading screen like you see one when booking flight
B) use Ajax with asynchronous call to DB


Hello peter budo, i reply to this thread because i'm trying to do a similar, terrible thing as himmat.
I've created a jsp that makes some query on database and some threads, called in the jspInit that update these databases.
jsp page:

public void jspInit() {
        alarmsManager    = new AlarmsManager();
public void jspDestroy(){
           this.alarmManager.[method that stops thread]

my question is: when is called jsp destroy? if i want my thread running alwais and so i delete the stop on jspdestroy is there the risk that are called multiple istance of the same thread?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.