Java 类io.reactivex.internal.subscriptions.EmptySubscription 实例源码

项目:RxConditions    文件:FlowableSwitchCase.java   
@Override
protected void subscribeActual(Subscriber<? super R> s) {
    K key;
    Publisher<? extends R> source;

    try {
        key = caseSelector.call();
        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        EmptySubscription.error(ex, s);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(s);
}
项目:RxConditions    文件:FlowableIfThen.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        EmptySubscription.error(ex, s);
        return;
    }

    if (b) {
        then.subscribe(s);
    } else {
        orElse.subscribe(s);
    }
}
项目:RxJava2Extensions    文件:PerhapsZipIterable.java   
@Override
protected void subscribeActual(Subscriber<? super R> s) {
    @SuppressWarnings("unchecked")
    Perhaps<? extends T>[] srcs = new Perhaps[8];
    int n = 0;

    try {
        for (Perhaps<? extends T> ph : sources) {
            if (srcs.length == n) {
                srcs = Arrays.copyOf(srcs, n + (n >> 1));
            }
            srcs[n++] = ph;
        }
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    ZipCoordinator<T, R> parent = new ZipCoordinator<T, R>(s, zipper, n);
    s.onSubscribe(parent);

    parent.subscribe(srcs, n);
}
项目:RxJava2Extensions    文件:FlowableSwitchCase.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    K key;
    Publisher<? extends T> source;

    try {
        key = caseSelector.call();

        source = mapOfCases.get(key);
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    if (source == null) {
        source = defaultCase;
    }

    source.subscribe(s);
}
项目:RxJava2Extensions    文件:FlowableIfThen.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    if (b) {
        then.subscribe(s);
    } else {
        orElse.subscribe(s);
    }
}
项目:akarnokd-misc    文件:ResourceFlowableIterable.java   
@Override
protected void subscribeActual(Subscriber<? super T> subscriber) {
    Iterator<? extends T> it;
    boolean b;
    try {
        it = items.iterator();

        b = it.hasNext();
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, subscriber);
        return;
    }

    if (!b) {
        EmptySubscription.complete(subscriber);
        return;
    }

    subscriber.onSubscribe(new RFIteratorSubscription<>(subscriber, release, it));
}
项目:RxJava2Extensions    文件:FlowableOrderedMerge.java   
@SuppressWarnings("unchecked")
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    Publisher<T>[] array = sources;
    int n;

    if (array == null) {
        array = new Publisher[8];
        n = 0;
        try {
            for (Publisher<T> p : sourcesIterable) {
                if (n == array.length) {
                    array = Arrays.copyOf(array, n << 1);
                }
                array[n++] = ObjectHelper.requireNonNull(p, "a source is null");
            }
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptySubscription.error(ex, s);
            return;
        }
    } else {
        n = array.length;
    }

    if (n == 0) {
        EmptySubscription.complete(s);
        return;
    }

    if (n == 1) {
        array[0].subscribe(s);
        return;
    }

    BasicMergeSubscription<T> parent = new BasicMergeSubscription<T>(s, comparator, n, prefetch, delayErrors);
    s.onSubscribe(parent);
    parent.subscribe(array, n);
}
项目:RxJava2Extensions    文件:BasicMergeSubscription.java   
public void subscribe(Publisher<T>[] sources, int n) {
  InnerQueuedSubscriber<T>[] subs = subscribers;
  for (int i = 0; i < n && !cancelled; i++) {
      Publisher<T> p = sources[i];
      if (p != null) {
          p.subscribe(subs[i]);
      } else {
          EmptySubscription.error(new NullPointerException("The " + i + "th source is null"), subs[i]);
          if (!delayErrors) {
              break;
          }
      }
  }
}
项目:RxJava2Extensions    文件:SoloDefer.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    Solo<T> sp;

    try {
        sp = ObjectHelper.requireNonNull(supplier.call(), "The supplier returned a null Solo");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    sp.subscribe(s);
}
项目:RxJava2Extensions    文件:SoloLift.java   
@Override
protected void subscribeActual(Subscriber<? super R> s) {
    Subscriber<? super T> parent;

    try {
        parent = ObjectHelper.requireNonNull(onLift.apply(s), "The onLift returned a null Subscriber");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    source.subscribe(parent);
}
项目:RxJava2Extensions    文件:NonoDefer.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    Nono np;

    try {
        np = ObjectHelper.requireNonNull(supplier.call(), "The supplier returned a null Nono");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    np.subscribe(s);
}
项目:RxJava2Extensions    文件:NonoFromAction.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    s.onSubscribe(EmptySubscription.INSTANCE);
    try {
        action.run();
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        s.onError(ex);
        return;
    }
    s.onComplete();
}
项目:RxJava2Extensions    文件:NonoErrorSupplier.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    Throwable ex;
    try {
    ex = ObjectHelper.requireNonNull(errorSupplier.call(), "The errorSupplier returned a null Throwable");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        ex = e;
    }

    EmptySubscription.error(ex, s);
}
项目:RxJava2Extensions    文件:PerhapsLift.java   
@Override
protected void subscribeActual(Subscriber<? super R> s) {
    Subscriber<? super T> parent;

    try {
        parent = ObjectHelper.requireNonNull(onLift.apply(s), "The onLift returned a null Subscriber");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    source.subscribe(parent);
}
项目:RxJava2Extensions    文件:SoloErrorSupplier.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    Throwable ex;

    try {
        ex = ObjectHelper.requireNonNull(errorSupplier.call(), "The errorSupplier returned a null Throwable");
    } catch (Throwable exc) {
        Exceptions.throwIfFatal(exc);
        ex = exc;
    }

    EmptySubscription.error(ex, s);
}
项目:RxJava2Extensions    文件:SoloZipIterable.java   
@Override
protected void subscribeActual(Subscriber<? super R> s) {
    int n = 0;
    @SuppressWarnings("unchecked")
    Solo<? extends T>[] array = new Solo[8];

    try {
        for (Solo<? extends T> inner : sources) {
            if (n == array.length) {
                array = Arrays.copyOf(array, n + (n >> 1));
            }
            array[n++] = ObjectHelper.requireNonNull(inner, "One of the source Solo is null");
        }
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    if (n == 0) {
        EmptySubscription.complete(s);
        return;
    } else
    if (n == 1) {
        array[0].subscribe(new MapSubscriber<T, R>(s, this));
        return;
    }

    ZipCoordinator<T, R> parent = new ZipCoordinator<T, R>(s, zipper, n);
    s.onSubscribe(parent);

    parent.subscribe(array, n);
}
项目:RxJava2Extensions    文件:PerhapsDefer.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    Perhaps<? extends T> sp;

    try {
        sp = ObjectHelper.requireNonNull(supplier.call(), "The supplier returned a null Solo");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    sp.subscribe(s);
}
项目:RxJava2Extensions    文件:NonoLift.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    Subscriber<? super Void> z;

    try {
        z = ObjectHelper.requireNonNull(lifter.apply(s), "The lifter returned a null Subscriber");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    source.subscribe(z);
}
项目:RxJava2Extensions    文件:PerhapsErrorSupplier.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    Throwable ex;

    try {
        ex = ObjectHelper.requireNonNull(errorSupplier.call(), "The errorSupplier returned a null Throwable");
    } catch (Throwable exc) {
        Exceptions.throwIfFatal(exc);
        ex = exc;
    }

    EmptySubscription.error(ex, s);
}
项目:RxJava2Extensions    文件:PerhapsFromAction.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    s.onSubscribe(EmptySubscription.INSTANCE);

    try {
        call();
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        s.onError(ex);
        return;
    }

    s.onComplete();
}
项目:akarnokd-misc    文件:ResourceFlowableDefer.java   
@Override
protected void subscribeActual(Subscriber<? super T> subscriber) {
    ResourceFlowable<T> rf;

    try {
        rf = call.call();
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, subscriber);
        return;
    }

    rf.subscribe(subscriber);
}
项目:RxJava2Extensions    文件:NonoNever.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    s.onSubscribe(EmptySubscription.INSTANCE);
}
项目:RxJava2Extensions    文件:PerhapsEmpty.java   
@Override
protected void subscribeActual(Subscriber<? super Object> s) {
    EmptySubscription.complete(s);
}
项目:RxJava2Extensions    文件:PerhapsError.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    EmptySubscription.error(error, s);
}
项目:RxJava2Extensions    文件:NonoError.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    EmptySubscription.error(error, s);
}
项目:RxJava2Extensions    文件:NonoComplete.java   
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    EmptySubscription.complete(s);
}
项目:RxJava2Extensions    文件:PerhapsNever.java   
@Override
protected void subscribeActual(Subscriber<? super Object> s) {
    s.onSubscribe(EmptySubscription.INSTANCE);
}
项目:RxJava2Extensions    文件:SoloNever.java   
@Override
protected void subscribeActual(Subscriber<? super Object> s) {
    s.onSubscribe(EmptySubscription.INSTANCE);
}
项目:RxJava2Extensions    文件:SoloError.java   
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    EmptySubscription.error(error, s);
}