io.reactivex.internal.fuseable.ConditionalSubscriber Java Examples

The following examples show how to use io.reactivex.internal.fuseable.ConditionalSubscriber. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParallelFlowableLife.java    From rxjava-RxLife with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void subscribe(@NonNull Subscriber<? super T>[] subscribers) {
    if (!validate(subscribers)) {
        return;
    }

    int n = subscribers.length;

    Subscriber<? super T>[] parents = new Subscriber[n];

    for (int i = 0; i < n; i++) {
        Subscriber<? super T> a = subscribers[i];
        if (a instanceof ConditionalSubscriber) {
            parents[i] = new LifeConditionalSubscriber<>((ConditionalSubscriber<? super T>) a, scope);
        } else {
            parents[i] = new LifeSubscriber<>(a, scope);
        }
    }
    ParallelFlowable<T> upStream = this.upStream;
    if (onMain) upStream = upStream.runOn(AndroidSchedulers.mainThread());
    upStream.subscribe(parents);
}
 
Example #2
Source File: ParallelFlowableOnAssembly.java    From RxJava2Debug with Apache License 2.0 6 votes vote down vote up
@Override
public void subscribe(Subscriber<? super T>[] s) {
    if (validate(s)) {
        int n = s.length;
        @SuppressWarnings("unchecked")
        Subscriber<? super T>[] parents = new Subscriber[n];
        for (int i = 0; i < n; i++) {
            Subscriber<? super T> z = s[i];
            if (z instanceof ConditionalSubscriber) {
                parents[i] = new OnAssemblyConditionalSubscriber<T>((ConditionalSubscriber<? super T>)z, assembled);
            } else {
                parents[i] = new OnAssemblySubscriber<T>(z, assembled);
            }
        }

        source.subscribe(parents);
    }
}
 
Example #3
Source File: RequestContextParallelFlowable.java    From armeria with Apache License 2.0 6 votes vote down vote up
@Override
public void subscribe(Subscriber<? super T>[] s) {
    if (!validate(s)) {
        return;
    }
    final int n = s.length;
    @SuppressWarnings("unchecked")
    final Subscriber<? super T>[] parents = new Subscriber[n];
    for (int i = 0; i < n; i++) {
        final Subscriber<? super T> z = s[i];
        if (z instanceof ConditionalSubscriber) {
            parents[i] = new RequestContextConditionalSubscriber<>(
                    (ConditionalSubscriber<? super T>) z, assemblyContext
            );
        } else {
            parents[i] = new RequestContextSubscriber<>(z, assemblyContext);
        }
    }
    try (SafeCloseable ignored = assemblyContext.push()) {
        source.subscribe(parents);
    }
}
 
Example #4
Source File: FlowableOnAssemblyCallable.java    From RxJava2Debug with Apache License 2.0 5 votes vote down vote up
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    if (s instanceof ConditionalSubscriber) {
        source.subscribe(new OnAssemblyConditionalSubscriber<T>((ConditionalSubscriber<? super T>)s, assembled));
    } else {
        source.subscribe(new OnAssemblySubscriber<T>(s, assembled));
    }
}
 
Example #5
Source File: FlowableOnAssemblyConnectable.java    From RxJava2Debug with Apache License 2.0 5 votes vote down vote up
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    if (s instanceof ConditionalSubscriber) {
        source.subscribe(new OnAssemblyConditionalSubscriber<T>((ConditionalSubscriber<? super T>)s, assembled));
    } else {
        source.subscribe(new OnAssemblySubscriber<T>(s, assembled));
    }
}
 
Example #6
Source File: RequestContextConnectableFlowable.java    From armeria with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    try (SafeCloseable ignored = assemblyContext.push()) {
        if (s instanceof ConditionalSubscriber) {
            source.subscribe(new RequestContextConditionalSubscriber<>(
                    (ConditionalSubscriber<? super T>) s, assemblyContext
            ));
        } else {
            source.subscribe(new RequestContextSubscriber<>(s, assemblyContext));
        }
    }
}
 
Example #7
Source File: RequestContextCallableFlowable.java    From armeria with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    try (SafeCloseable ignored = assemblyContext.push()) {
        if (s instanceof ConditionalSubscriber) {
            source.subscribe(new RequestContextConditionalSubscriber<>(
                    (ConditionalSubscriber<? super T>) s, assemblyContext
            ));
        } else {
            source.subscribe(new RequestContextSubscriber<>(s, assemblyContext));
        }
    }
}
 
Example #8
Source File: RequestContextFlowable.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    try (SafeCloseable ignored = assemblyContext.push()) {
        if (s instanceof ConditionalSubscriber) {
            source.subscribe(new RequestContextConditionalSubscriber<>(
                    (ConditionalSubscriber<? super T>) s, assemblyContext
            ));
        } else {
            source.subscribe(new RequestContextSubscriber<>(s, assemblyContext));
        }
    }
}
 
Example #9
Source File: RequestContextScalarCallableFlowable.java    From armeria with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    try (SafeCloseable ignored = assemblyContext.push()) {
        if (s instanceof ConditionalSubscriber) {
            source.subscribe(new RequestContextConditionalSubscriber<>(
                    (ConditionalSubscriber<? super T>) s, assemblyContext
            ));
        } else {
            source.subscribe(new RequestContextSubscriber<>(s, assemblyContext));
        }
    }
}
 
Example #10
Source File: LifeConditionalSubscriber.java    From rxjava-RxLife with Apache License 2.0 4 votes vote down vote up
LifeConditionalSubscriber(ConditionalSubscriber<? super T> downstream, Scope scope) {
    super(scope);
    this.downstream = downstream;
}
 
Example #11
Source File: RequestContextConditionalSubscriber.java    From armeria with Apache License 2.0 4 votes vote down vote up
RequestContextConditionalSubscriber(ConditionalSubscriber<? super T> downstream,
                                    RequestContext assemblyContext) {
    super(downstream);
    this.assemblyContext = assemblyContext;
}