Server Sent Events / Servlet 3 async processing.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Server Sent Events / Servlet 3 async processing.

tonywestonuk
Hi,

If I am making use of Server Sent Events, and my server uses async processing to save using lots of threads.., there is an issue with deciding if a AsyncContext has timed out or complete.


1)  when the doGet is invoked,  an AsyncContext is created from request.startAsync().  This asyncContext is shown as below if printed to the logs:
 org.apache.openejb.server.httpd.EEFilter$AsynContextWrapper@249fafc5

2) An AsyncListener is added that monitors for the asyncContext closed.

3) If complete/timeout/error,  the context that is passed is logged as:
 org.apache.catalina.core.AsyncContextImpl@6268922e


As the first asyncContext that is returned from request.startAsync(), is not the same as that which is passed to the listener methods, it makes it impossible to tidy up, as I cant tell which completed AsyncContext referrers to which was stored at the time of the initial request.

Help :/

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Server Sent Events / Servlet 3 async processing.

Romain Manni-Bucau
Hi Tony,

you can rely on the request normally or any request/session attribute


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-08-11 16:57 GMT+02:00 tonywestonuk <[hidden email]>:

> Hi,
>
> If I am making use of Server Sent Events, and my server uses async
> processing to save using lots of threads.., there is an issue with deciding
> if a AsyncContext has timed out or complete.
>
>
> 1)  when the doGet is invoked,  an AsyncContext is created from
> request.startAsync().  This asyncContext is shown as below if printed to
> the
> logs:
>  org.apache.openejb.server.httpd.EEFilter$AsynContextWrapper@249fafc5
>
> 2) An AsyncListener is added that monitors for the asyncContext closed.
>
> 3) If complete/timeout/error,  the context that is passed is logged as:
>  org.apache.catalina.core.AsyncContextImpl@6268922e
>
>
> As the first asyncContext that is returned from request.startAsync(), is
> not
> the same as that which is passed to the listener methods, it makes it
> impossible to tidy up, as I cant tell which completed AsyncContext
> referrers
> to which was stored at the time of the initial request.
>
> Help :/
>
> Thanks.
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/Server-Sent-Events-Servlet-3-async-processing-tp4682442.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Loading...