users@jax-rs-spec.java.net

[jax-rs-spec users] Re: Server-Sent Events API proposal

From: Alessio Soldano <asoldano_at_redhat.com>
Date: Wed, 1 Feb 2017 16:50:02 +0100

Il 01/02/2017 16:15, Pavel Bucek ha scritto:
>
> Hi Alessio,
>
> please see inline.
>
>
> On 01/02/2017 15:29, Alessio Soldano wrote:
>> Il 24/01/2017 20:54, Pavel Bucek ha scritto:
>>>
>>> The API was introduced a while back [1], but we did incorporate some
>>> changes, mostly alignments with Java SE 8 and another one, slightly
>>> more controversial - alignment with Java SE 9 Flow API.
>>>
>>> Why we should use Flow API? We want to make the transition to Java 9
>>> as smooth as possible. Please note that today, the JAX-RS sources do
>>> contain Flow class (1:1 copy from Java SE 9), but that is NOT a
>>> final state. We want to work with it as much as possible, but we
>>> will minimize and clean up the code before final release. How?
>>> Consider following example:
>>>
>>> public interface SseBroadcasterextends AutoCloseable, Flow.Publisher<OutboundSseEvent> {
>>> //...
>>> }
>>>
>>> could be modified to
>>>
>>> public interface SseBroadcasterextends AutoCloseable {
>>> //...
>>> void subscribe(SseSubscriber<?super OutboundSseEvent> subscriber);
>>> }
>>>
>>> I hope you will like the attempt to be "forward-compatible", but I
>>> assume that this proposal alone will bring some opinions - please
>>> share them!
>>>
>> Just as a confirmation, so basically the idea is to keep this copy of
>> the Flow api in jaxrs api snapshots for now to prove we'll eventually
>> be able to use the real Flow interface from java 9 and actually
>> modify the jaxrs api (removing the Flow copy, etc) just before going
>> final?
> JAX-RS 2.1 will be based in Java SE 8 (as the rest of Java EE 8), so
> we cannot depend on the actual class from Java SE 9 yet. But what we
> can do is to craft the API in a way when we can easily extend /
> implement Flow APIs in JAX-RS which will be part of Java EE 9 (running
> on Java SE 9).
>
> So:
> - Flow class, which is currently in place, will be removed
> - All usages of that will be refactored. It could mean only declaring
> some methods (like SseBroadcaster) or introducing new Interfaces
> (SseSubcriber)
> - When Java EE 9 is released, JAX-RS classes/interfaces should be
> modified to extend java.util.concurrent.Flow.* where applicable
>
>
>
> Current state:
> public interface SseBroadcasterextends AutoCloseable, javax.ws.rs.Flow.Publisher<OutboundSseEvent> {
> //...
> }
>
> JAX-RS 2.1 release:
>
> public interface SseBroadcasterextends AutoCloseable {
> //...
> void subscribe(SseSubscriber<?super OutboundSseEvent> subscriber);
> }
> JAX-RS NEXT:
> public interface SseBroadcasterextends AutoCloseable, java.util.concurrent.Flow.Publisher<OutboundSseEvent> {
> //...
> }
>
OK, this is what I understood, thanks for confirmation.

Cheers
Alessio