-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
11
A DESCRIPTION OF THE PROBLEM :
The JavaDoc of java.util.concurrent.Flow has an example of a Publisher implementation called OneShotPublisher. If a subscription has already been registered when a second subscription request runs, then the provided Subscriber object will have his onError method called immediately without a preceding call to the onSubscribe method.
Well, this is wrong according to the reactive-streams spec, paragraph 1.9;
"Publisher.subscribe MUST call onSubscribe on the provided Subscriber prior to any other signals to that Subscriber [...] the only legal way to signal failure (or reject the Subscriber) is by calling onError (after calling onSubscribe)."
I think the JavaDoc example could be indicative that the reactive-streams spec should change; i.e., it should be allowed to call the onError method before calling the onSubscribe? However that might be, the current example is still in violation of the reactive-streams spec.
Paragraph link: https://github.com/reactive-streams/reactive-streams-jvm/tree/9464664fb98011e0d1cf976ce22951fe08963469#1.9
The JavaDoc of java.util.concurrent.Flow has an example of a Publisher implementation called OneShotPublisher. If a subscription has already been registered when a second subscription request runs, then the provided Subscriber object will have his onError method called immediately without a preceding call to the onSubscribe method.
Well, this is wrong according to the reactive-streams spec, paragraph 1.9;
"Publisher.subscribe MUST call onSubscribe on the provided Subscriber prior to any other signals to that Subscriber [...] the only legal way to signal failure (or reject the Subscriber) is by calling onError (after calling onSubscribe)."
I think the JavaDoc example could be indicative that the reactive-streams spec should change; i.e., it should be allowed to call the onError method before calling the onSubscribe? However that might be, the current example is still in violation of the reactive-streams spec.
Paragraph link: https://github.com/reactive-streams/reactive-streams-jvm/tree/9464664fb98011e0d1cf976ce22951fe08963469#1.9