Skip to content

2.x & 3.x Question: Will ParallelFlowable support RxJavaPlugins#onFlowableSubscribe?  #7190

@kojilin

Description

@kojilin

Hi
I'm trying to inject context(put to ThreadLocal) when subscribing with RxJavaPlugins#onXxxSubscribe to make each operation can access the context.
After running the test case, the Flowable runs correctly, but if I use Flowable#parallel, I think each subscribe doesn't use RxJavaPlugins.onSubscribe and I can't customize the subscriber.
Curious if it's intentioned, or for example, ParallelMap needs to like below in subscribe?

 @Override
    public void subscribe(Subscriber<? super R>[] subscribers) {
       .....
        for (int i = 0; i < n; i++) {
            // wrap with hook here?
            Subscriber<? super R> a =  RxJavaPlugins.onSubscribe(this, subscribers[i]);
            if (a instanceof ConditionalSubscriber) {
                parents[i] = new ParallelMapConditionalSubscriber<T, R>((ConditionalSubscriber<? super R>)a, mapper);
            } else {
                parents[i] = new ParallelMapSubscriber<T, R>(a, mapper);
            }
        }
        source.subscribe(parents);
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions