Closed danielkec closed 4 years ago
What's even more odd is that no test fails because of this.
DefaultCompletionSubscriber
really just holds both a Subscriber
and a CompletionStage
and delegates calls to the Subscriber
.
It's up to the creator of the DefaultCompletionSubscriber
to ensure that the CompletionStage
passed into CompletionSubscriber.of
is redeemed when the subscriber completes or terminates.
In the core implmentation, the CompletionStage
is obtained from the call to engine.buildSubscriber
.
As a side note, there's actually no way to manually redeem a CompletionStage
via that interface. It's up to the CompletionStage
implementation as to how it gets redeemed. Usually, the implementation is CompletableFuture
and it's redeemed using the complete
method.
It does not seems right for it to be part of the API as it may lead to wrong conclusions. Maybe change the javadoc of the of
method for something like: Create wrapper for already associated CompletionStage and Subscriber
, to make it clear what is expected?
Yes, I think that makes sense.
I've opened #150 to make it clear what the caller's responsibilities are if you'd like to take a look @danielkec.
Interface javadoc says
But DefaultCompletionSubscriber does nothing with supplied CompletionStage in both cases: