You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lior Shliechkorn <li...@yahoo.com> on 2003/04/25 16:11:42 UTC

[OFF-TOPIC] Threads

Hi, I was wondering if anyone would be able to help me with this matter. I'm running reports that take a little while to run, and I want to display a page that gives a message that the report is being generated with a thread that runs the report and checks whether the report is done. I'm not sure how to implement this, and I was hoping that someone can help by perhaps showing me some code, or pointing me in the right direction. Thank you very much,
Lior


---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.

Re: [OFF-TOPIC] Threads

Posted by Qing Xie <xi...@ecopiabio.com>.
There is a complete sample on book "The complete reference JSP" (page 
407) by Phil Hanna.

The key technique is using a background session-scoped thread to do the 
work and using the <META HTTP-EQUIV="REFRESH"> HTML tag to have the web 
browser automatically monitor the status.

Qing

Mark Pease wrote:

>I have never done this, and have no clue if it would work, but could you
>generate the HTML that says your report is being generated, flush the buffer
>(to send it to the client), then run your processing code, and after it is
>complete redirect to the report page?
>
>Maybe you could do all this in one servlet, and not have to worry about the
>complexity of your proposed solution (multiple threads, listeners, etc.).
>
>Just a thought - good luck!
>Mark
>
>----- Original Message -----
>From: "Lior Shliechkorn" <li...@yahoo.com>
>To: "Tomcat" <to...@jakarta.apache.org>
>Sent: Friday, April 25, 2003 10:11 AM
>Subject: [OFF-TOPIC] Threads
>
>
>  
>
>>Hi, I was wondering if anyone would be able to help me with this matter.
>>    
>>
>I'm running reports that take a little while to run, and I want to display a
>page that gives a message that the report is being generated with a thread
>that runs the report and checks whether the report is done. I'm not sure how
>to implement this, and I was hoping that someone can help by perhaps showing
>me some code, or pointing me in the right direction. Thank you very much,
>  
>
>>Lior
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>The New Yahoo! Search - Faster. Easier. Bingo.
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: [OFF-TOPIC] Threads

Posted by Mark Pease <mp...@chartermi.net>.
I have never done this, and have no clue if it would work, but could you
generate the HTML that says your report is being generated, flush the buffer
(to send it to the client), then run your processing code, and after it is
complete redirect to the report page?

Maybe you could do all this in one servlet, and not have to worry about the
complexity of your proposed solution (multiple threads, listeners, etc.).

Just a thought - good luck!
Mark

----- Original Message -----
From: "Lior Shliechkorn" <li...@yahoo.com>
To: "Tomcat" <to...@jakarta.apache.org>
Sent: Friday, April 25, 2003 10:11 AM
Subject: [OFF-TOPIC] Threads


> Hi, I was wondering if anyone would be able to help me with this matter.
I'm running reports that take a little while to run, and I want to display a
page that gives a message that the report is being generated with a thread
that runs the report and checks whether the report is done. I'm not sure how
to implement this, and I was hoping that someone can help by perhaps showing
me some code, or pointing me in the right direction. Thank you very much,
> Lior
>
>
> ---------------------------------
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: [OFF-TOPIC] Threads

Posted by Tim Funk <fu...@joedog.org>.
/*pseudo code*/

service(...) {
    Object thingThatImplementsRunnable = new Something();
    thingThatImplementsRunnable.init();
    Thread thread = new Thread(thingThatImplementsRunnable);
    thread.start();
    //stuff thingThatImplementsRunnable into session

    redirect to jsp
}

------------------------
in jsp
- look at session variable - is it still running?
- if still running - say so
- if not running - include or forward to whereever and CLEANUP!
- make sure page has meta refresh - or button to let user refresh


-Tim

Lior Shliechkorn wrote:
> Hi, I was wondering if anyone would be able to help me with this matter. I'm running reports that take a little while to run, and I want to display a page that gives a message that the report is being generated with a thread that runs the report and checks whether the report is done. I'm not sure how to implement this, and I was hoping that someone can help by perhaps showing me some code, or pointing me in the right direction. Thank you very much,
> Lior
> 
> 
> ---------------------------------
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org