@Override public void subscribeActual(Subscriber<? super T> s) { S state; try { state = stateSupplier.call(); } catch (Throwable e) { Exceptions.throwIfFatal(e); EmptySubscription.error(e, s); return; } s.onSubscribe(new GeneratorSubscription<T, S>(s, generator, disposeState, state)); }
public SchedulerWhen(Function<Flowable<Flowable<Completable>>, Completable> combine, Scheduler actualScheduler) { this.actualScheduler = actualScheduler; // workers are converted into completables and put in this queue. this.workerProcessor = UnicastProcessor.<Flowable<Completable>>create().toSerialized(); // send it to a custom combinator to pick the order and rate at which // workers are processed. try { disposable = combine.apply(workerProcessor).subscribe(); } catch (Throwable e) { Exceptions.propagate(e); } }
@Override public void request(long n) { try { parent.onRequest.accept(n); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } s.request(n); }
@Override public void subscribeActual(Subscriber<? super T> s) { Throwable error; try { error = ObjectHelper.requireNonNull(errorSupplier.call(), "Callable returned null throwable. Null values are generally not allowed in 2.x operators and sources."); } catch (Throwable t) { Exceptions.throwIfFatal(t); error = t; } EmptySubscription.error(error, s); } }
@Override protected void subscribeActual(SingleObserver<? super T> s) { Throwable error; try { error = ObjectHelper.requireNonNull(errorSupplier.call(), "Callable returned null throwable. Null values are generally not allowed in 2.x operators and sources."); } catch (Throwable e) { Exceptions.throwIfFatal(e); error = e; } EmptyDisposable.error(error, s); }
@Override public void subscribeActual(Observer<? super T> s) { Throwable error; try { error = ObjectHelper.requireNonNull(errorSupplier.call(), "Callable returned null throwable. Null values are generally not allowed in 2.x operators and sources."); } catch (Throwable t) { Exceptions.throwIfFatal(t); error = t; } EmptyDisposable.error(error, s); } }
@Override protected void subscribeActual(CompletableObserver s) { Throwable error; try { error = ObjectHelper.requireNonNull(errorSupplier.call(), "The error returned is null"); } catch (Throwable e) { Exceptions.throwIfFatal(e); error = e; } EmptyDisposable.error(error, s); }
@Override public void run() { if (!disposed) { try { run.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); worker.dispose(); throw ExceptionHelper.wrapOrThrow(ex); } } }
@Override public void run() { if (!disposed) { try { run.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); worker.dispose(); throw ExceptionHelper.wrapOrThrow(ex); } } }
/** * Rethrows the throwable if it is a fatal exception or calls {@link #onError(Throwable)}. * @param t the throwable to rethrow or signal to the actual subscriber */ protected final void fail(Throwable t) { Exceptions.throwIfFatal(t); s.cancel(); onError(t); }
private void onAfterTerminate() { try { onAfterTerminate.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } } }
void doAfter() { try { onAfterTerminate.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } }
/** * Rethrows the throwable if it is a fatal exception or calls {@link #onError(Throwable)}. * @param t the throwable to rethrow or signal to the actual subscriber */ protected final void fail(Throwable t) { Exceptions.throwIfFatal(t); s.dispose(); onError(t); }
private void dispose(S s) { try { disposeState.accept(s); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } }
@Override public void cancel() { try { s.cancel(); } catch (Throwable e1) { Exceptions.throwIfFatal(e1); RxJavaCommonPlugins.onError(e1); } } }
/** * Rethrows the throwable if it is a fatal exception or calls {@link #onError(Throwable)}. * @param t the throwable to rethrow or signal to the actual subscriber */ protected final void fail(Throwable t) { Exceptions.throwIfFatal(t); s.dispose(); onError(t); }
private void onAfterTerminate() { try { onAfterTerminate.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } } }
private void dispose(S s) { try { disposeState.accept(s); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } }
@Override public void onSuccess(T value) { lazySet(DisposableHelper.DISPOSED); try { onSuccess.accept(value); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaCommonPlugins.onError(ex); } }
@Override public void onSuccess(T t) { actual.onSuccess(t); try { onAfterSuccess.accept(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); // remember, onSuccess is a terminal event and we can't call onError RxJavaCommonPlugins.onError(ex); } }