jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: Adding support for obtaining post parameters asynchronously

From: Greg Wilkins <gregw_at_webtide.com>
Date: Tue, 8 Dec 2015 17:21:15 +1100

On 8 December 2015 at 11:30, Edward Burns <edward.burns_at_oracle.com> wrote:

> GW> I think those options need to be morphed into something that
> GW> operates in the same isReady() loop/callback style of the
> GW> ReadListener, which provides both flow control and help to avoid
> GW> deep callback recursion. Perhaps something like:
>
>
> GW> interface ParameterListener
> GW> {
> GW> void onParameterAvailable(Stream stream};
>
> GW> public interface Stream
> GW> {
> GW> boolean isReady();
> GW> Map.Entry<String,String> getParameter();
> GW> }
> GW> }
>
> This and your other examples beg the question: how do we depend on
> Stream when our maximum JDK level is SE 8?
>
> [...
>
> GW> So in summary, I'm not opposed to making the supported functionality
> GW> in async mode match that of blocking mode, but if we do so it needs
> GW> to support back pressure and to be a near complete match to the
> GW> blocking functionality.
>
> But can we support back pressure without introducing a dependency on the
> actual Streams API?
>
> Thanks,
>

Ed,

actually this example is not using reactive style. Instead it is an
extension of Martin's proposed ParameterListener that will support back
pressure by behaving in exactly the same way as the current isReady async
IO ReadListener.

Perhaps Stream was not the best name to use for that sub interface :)

As for using the reactive stream API, it is available now, but just not in
the package hierarchy that it will be in Java9. I'm not sure it is
acceptable to have javax APIs depend on non-javax APIs, so perhaps Reactive
Streams themselves are a non-starter until Servlet 4.1

Note however, that it has been moderately easy to write adaptors from the
isReady byte IO in the servlet API to reactive streams API - so if we
support a similar semantic for async parameters and parts, we should be
able to later adapt them to the Reactive Stream API.

cheers










-- 
Greg Wilkins <gregw@webtide.com> CTO http://webtide.com