You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Geoff Davies <ge...@yahoo.com> on 2006/08/30 23:44:24 UTC

Yet Another Threads & Servlets question but with a JSF twist

I have JSF managed bean running in a Tomcat 5.5 server on windows xp.
The code in a nutshell is this:
EndToEndThread etoE = new EndToEndThread(term,freq,year,month,period);
bgTask = new Thread(etoE);
bgTask.run();
System.err.println(TimeUtils.dateNow() + "Thread is running");
return result;

The idea was to have the user enter some job parameters and then kick off the
job in a background thread.  The intention is to then have a refreshable page
that can display the progress of the background job.

The problem is that it appears the main code (the JSF bean) does not continue
to run until the background thread is complete.  The threaded task takes some
time (over a minute) so I was expecting it to run in the background whilst
letting the JSF page complete.  I tried tricks such making the background
thread sleep for a few seconds but it doesn't make any difference.  The main
code is held up until the thread completes.  

Any ideas?

Regards,
Geoff.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Yet Another Threads & Servlets question but with a JSF twis

Posted by Michael Jouravlev <jm...@gmail.com>.
I suggest changing bgTask.run() to bgTask.start().

On 8/30/06, Geoff Davies <ge...@yahoo.com> wrote:
> I have JSF managed bean running in a Tomcat 5.5 server on windows xp.
> The code in a nutshell is this:
> EndToEndThread etoE = new EndToEndThread(term,freq,year,month,period);
> bgTask = new Thread(etoE);
> bgTask.run();
> System.err.println(TimeUtils.dateNow() + "Thread is running");
> return result;
>
> The idea was to have the user enter some job parameters and then kick off the
> job in a background thread.  The intention is to then have a refreshable page
> that can display the progress of the background job.
>
> The problem is that it appears the main code (the JSF bean) does not continue
> to run until the background thread is complete.  The threaded task takes some
> time (over a minute) so I was expecting it to run in the background whilst
> letting the JSF page complete.  I tried tricks such making the background
> thread sleep for a few seconds but it doesn't make any difference.  The main
> code is held up until the thread completes.
>
> Any ideas?
>
> Regards,
> Geoff.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org