On Fri, Nov 1, 2024 at 10:22 AM Niran Abeygunawardena <
niran.abeygunaward...@clarivate.com> wrote:

> Hi,
>

Hello!


>  If I use the ProgressiveDisplay component to display a long running task
> later, it looks like the tomcat thread is not released back to its pool
> immediately so there may be less tomcat threads available then?
>

ProgressiveDisplay itself does nothing but create a Zone that gets updated
once after the DOM is loaded by making an ordinary AJAX request. If there's
a thread not being released back to the pool, it's not related to Tapestry
itself, but your own code, I'm afraid. If your code has some long-running
processing and it's done in a request thread, that thread won't be returned
to the pool until it finishes.


>  For example, from the extremely helpful jumpstart site,
>

It indeed is!


> I can see the XHR call does not return immediately and waits 6 seconds:
>
>
> https://tapestry-jumpstart.org/jumpstart/examples/ajax/progressivedisplayvariations
>

Yes, one of the events has a Thread.sleep(6000) on it to simulate a
longer-running process. Image didn't make through the mailing list handler,
though


> Tapestry has an interface to
> https://tapestry.apache.org/current/apidocs/org/apache/tapestry5/http/internal/AsyncRequestService.html
> which looks like it may be using the servlet 3’s asynchronous Servlet API
> requests but is an example of its use or some documentation on its use?
>

Indeed, it's missing documentation.


>  Alternatively, another option is some kind of polling to keep checking
> when the long running process is ready so the tomcat thread isn’t held on?
> Are there any other approaches to this issue so the tomcat thread isn’t
> being held too long with a ProgressiveDisplay?
>

Another possibility is your code running the long process in a new,
non-request thread and use a Zone with the ZoneRefresh mixin to have it
updated every n seconds.

Cheers!


>
> Thanks,
> Niran
>
> Confidentiality note: This e-mail may contain confidential information
> from Clarivate. If you are not the intended recipient, be aware that any
> disclosure, copying, distribution or use of the contents of this e-mail is
> strictly prohibited. If you have received this e-mail in error, please
> delete this e-mail and notify the sender as soon as possible.
>


-- 
Thiago H. de Paula Figueiredo
Software developer/engineer
Apache Tapestry consultant, committer and project management committee
member
You can sponsor my work on Tapestry at
https://github.com/sponsors/machina-br

Reply via email to