Hi,

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

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)

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"/>
<%dis.start();%>

>

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.

And what are you actually trying to do? Pagination?

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?

ok,

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.

Executing query as getting some data from database? If so this is terrible way to do it.

plz tell me what is problem there?

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

Thanks for reply......

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();
        this.alarmsManager.start();
} 
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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.