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

Subject.toSerialized #1834

Merged
merged 1 commit into from
Nov 9, 2014

Conversation

benjchristensen
Copy link
Member

Adds toSerialized as discussed in #1748

Adds toSerialized as discussed in ReactiveX#1748
@zsxwing
Copy link
Member

zsxwing commented Nov 8, 2014

Could you change SerializedSubject to an interface, and change current SerializedSubject class to a DefaultSerializedSubject, like @samuelgruetter said in #1748 (comment)? So that a custom SerializedSubject does not need to extend the default implementation. I think it will be friendlier to extend.

@benjchristensen
Copy link
Member Author

Why would we want a custom SerializedSubject? The point of SerializedSubject IS the implementation.

@benjchristensen
Copy link
Member Author

Also, this is matching the pattern of SerializedObserver and SerializedSubscriber.

Each of these are "serialized" implementations of the interface they implement.

@samuelgruetter
Copy link
Contributor

I think the question is the following: Is there only one possible reasonable implementation of SerializedSubject? If yes, there's no need for an interface, if no, an interface might be a good idea.
I don't have enough experience to answer this question.

@benjchristensen
Copy link
Member Author

There are really only 3 ways to approach this that I'm aware of:

  • Using blocking synchronization. We are trying to avoid that. We used to have SynchronizedObserver and replaced it with SerializedObserver.
  • Using queues and thread-stealing to push through. This is the model SerializedObserver and SerializedSubject use.
  • Using an MPSC queue with a separate thread to drain (standard producer/consumer). We don't want to add extra concurrency so are avoiding that. If an extra thread is wanted then observeOn is the answer.

Thus, there is really only one approach we want for this, and that is the SerializedObserver approach, hence SerializedSubject, which is an implementation of Subject that adds the Serialized capability.

benjchristensen added a commit that referenced this pull request Nov 9, 2014
@benjchristensen benjchristensen merged commit 9073177 into ReactiveX:1.x Nov 9, 2014
@benjchristensen benjchristensen deleted the toSerializedSubject branch November 9, 2014 00:03
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.

3 participants