Skip to content

Align Mono#share() behavior with Flux#share, split sink impl out#2756

Merged
simonbasle merged 6 commits into
mainfrom
2680-monoShareCacheInconsistencies
Sep 9, 2021
Merged

Align Mono#share() behavior with Flux#share, split sink impl out#2756
simonbasle merged 6 commits into
mainfrom
2680-monoShareCacheInconsistencies

Conversation

@simonbasle

@simonbasle simonbasle commented Aug 16, 2021

Copy link
Copy Markdown
Contributor
  • Ensure mono.share().subscribe() returns a dedicated Disposable
  • Old behavior of returning the underlying NextProcessor (which can then be
    terminated) is still reachable through mono.toProcessor() (deprecated)
  • Ensure cancelling mono.share() subscribers behaves like a reference counted
    multicast, ie the same as Flux#share: upstream is cancelled and next incoming
    subscriber will trigger an upstream re-subscription
  • Ensure this doesn't impact Sinks.one() by splitting out the implementation
    into SinkOneMulticast
  • copy relevant tests in NextProcessorTest for SinkOneMulticastTest

Fixes #2680.

@simonbasle simonbasle force-pushed the 2680-monoShareCacheInconsistencies branch from 84814b7 to 1fc32c6 Compare September 7, 2021 16:49
@simonbasle simonbasle marked this pull request as ready for review September 7, 2021 16:49
@simonbasle simonbasle requested a review from a team as a code owner September 7, 2021 16:49

@OlegDokuka OlegDokuka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@simonbasle simonbasle added type/bug A general bug type/enhancement A general enhancement labels Sep 9, 2021
@simonbasle simonbasle added this to the 3.4.10 milestone Sep 9, 2021
@simonbasle simonbasle changed the title Have Mono#share() behave more like Flux#share, split sink case out Align Mono#share() behavior with Flux#share, split sink impl out Sep 9, 2021
@simonbasle simonbasle merged commit 472b169 into main Sep 9, 2021
@simonbasle simonbasle deleted the 2680-monoShareCacheInconsistencies branch September 9, 2021 15:35
chemicL added a commit that referenced this pull request Mar 6, 2024
Similarly to Flux#share, Mono#share also cancels the source when all
Subscribers have cancelled. This change improves the documentation.

Following #2680 and #2756 there exists a misalignment in the javadoc for
Mono#share method. Since cancelling the source is a fact, the
javadoc is now improved instead of changing the behaviour.

Resolves #3740
chemicL added a commit that referenced this pull request Mar 6, 2024
Similarly to Flux#share, Mono#share also cancels the source when all
Subscribers have cancelled. This change improves the documentation.

Following #2680 and #2756 there exists a misalignment in the javadoc for
Mono#share method. Since cancelling the source is a fact, the
javadoc is now improved instead of changing the behaviour.

Resolves #3740
chemicL added a commit that referenced this pull request Mar 7, 2024
Similarly to `Flux#share`, `Mono#share` also cancels the source when all
`Subscriber`s have cancelled. This change improves the documentation.

Following #2680 and #2756 there exists a misalignment in the javadoc for
`Mono#share` method. Since cancelling the source is a fact, the javadoc
is now improved instead of changing the behaviour.

Resolves #3740
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug A general bug type/enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mono.share() is canceled on subscription disposal

2 participants