tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: 8.5.2 async state?
Date Tue, 17 May 2016 11:05:52 GMT
I see, that's however a regression for tomcat users. could the async
listener wrapper impl this if a tomcat flag is switched on?


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

2016-05-17 13:03 GMT+02:00 Violeta Georgieva <milesg78@gmail.com>:

> Hi,
>
> 2016-05-17 13:46 GMT+03:00 Romain Manni-Bucau <rmannibucau@gmail.com>:
> >
> > the real issue is adding a listener there trigger onStartAsync()*ONLY*
> (no
> > onCompleted(), onTimeout(), onError() etc... cause
> > org.apache.catalina.core.AsyncContextImpl#setStarted does
> listeners.clear();
> > )
> >
>
> That's behaviour is by spec:
>
> "public void addListener(AsyncListener) - Registers the given listener for
> notifications of onTimeout, onError, onComplete or onStartAsync. The first
> three are associated with the most recent asynchronous cycle started by
> calling
> one of the ServletRequest.startAsync methods. The onStartAsync is
> associated to a new asynchronous cycle via one of the
> ServletRequest.startAsync
> methods."
>
> so you can do the following:
>
>         public void onStartAsync(AsyncEvent event) throws IOException {
>             // Re-add this listener to the new AsyncContext
>             event.getAsyncContext().addListener(this);
>         }
>
> Regards,
> Violeta
>
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-05-17 12:43 GMT+02:00 Rémy Maucherat <remm@apache.org>:
> >
> > > 2016-05-17 12:37 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com>:
> > >
> > > > Only found https://bz.apache.org/bugzilla/show_bug.cgi?id=59261
> which
> > > > doesn't mean this code would be invalid
> > > >
> > > > Also if you add a listener eagerly you will have the start event and
> > > loose
> > > > all "end" (completed, timeout etc...) ones. This doesn't sound very
> > > > reliable.
> > > >
> > > > Can you point me out the related issue please?
> > > >
> > > > The bugzilla title says: "Request getAsyncContext should throw
> > > IllegalStateException if async is not started". So that's what happens
> now.
> > >
> > > Rémy
> > >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message