Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription overhaul2 #620

Closed
wants to merge 5 commits into from

Conversation

akarnokd
Copy link
Member

Renamed and changed things according to comments in #603

@cloudbees-pull-request-builder

RxJava-pull-requests #554 SUCCESS
This pull request looks good

@headinthebox
Copy link
Contributor

I like to keep the number of different Subscriptions as small as possible

What is the use-case for ValuedCompositeSubscription?
What is the use-case SafeObservableSubscription?

@akarnokd
Copy link
Member Author

Use case for ValuedCompositeSubscription: associate observers with their subscriptions.

ValuedCompositeSubscription<Observable<? super T>> observers = ...

but I usually ended up using regular map and locks anyway. So it is not that essential.

SafeObservableSubscription was implemented way before SingleAssignmentSubscription. I'd support the latter one and drop the former.

@headinthebox
Copy link
Contributor

I like MultipleAssignmentSubscription, SerialSubscription, SingleAssignmentSubscription hierarchy.

@akarnokd
Copy link
Member Author

Why not:

  • AbstractAssignmentSubscription
    • MultipleAssignmentSubscription
    • SerialSubscription
    • SingleAssignmentSubscription

/ adds setSubscription(...) throws if sets twice (like "val")
SingleAssignmentSubscription extends BooleanSubscription

// allows to setSubscription twice, leaves previous unchanged (like "var")
MultipleAssignmentSubscription extends SingleAssignmentSubscription

// allows to setSubscription twice, unsubscribes old one.
SerialSubscription extends MultipleAssignmentSubscription previous

Here I'd need to suppress/override onPreSwap in MultipleAssignmentSubscription instead of overriding an empty onPreSwap with the state check.

@benjchristensen
Copy link
Member

Inspired changes done in #661

@akarnokd akarnokd deleted the SubscriptionOverhaul2 branch January 13, 2014 09:59
jihoonson pushed a commit to jihoonson/RxJava that referenced this pull request Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants