io.reactivex.Observable.subscribeActual()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中io.reactivex.Observable.subscribeActual()方法的一些代码示例,展示了Observable.subscribeActual()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.subscribeActual()方法的具体详情如下:
包路径:io.reactivex.Observable
类名称:Observable
方法名:subscribeActual

Observable.subscribeActual介绍

[英]Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic.

There is no need to call any of the plugin hooks on the current Observable instance or the Subscriber.
[中]操作员实现(源代码和中间代码)应该实现这个执行必要业务逻辑的方法。
不需要调用当前可观察实例或订阅服务器上的任何插件挂钩。

代码示例

代码示例来源:origin: ReactiveX/RxJava

@SchedulerSupport(SchedulerSupport.NONE)
@Override
public final void subscribe(Observer<? super T> observer) {
  ObjectHelper.requireNonNull(observer, "observer is null");
  try {
    observer = RxJavaPlugins.onSubscribe(this, observer);
    ObjectHelper.requireNonNull(observer, "The RxJavaPlugins.onSubscribe hook returned a null Observer. Please change the handler provided to RxJavaPlugins.setOnObservableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins");
    subscribeActual(observer);
  } catch (NullPointerException e) { // NOPMD
    throw e;
  } catch (Throwable e) {
    Exceptions.throwIfFatal(e);
    // can't call onError because no way to know if a Disposable has been set or not
    // can't call onSubscribe because the call might have set a Subscription already
    RxJavaPlugins.onError(e);
    NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
    npe.initCause(e);
    throw npe;
  }
}

代码示例来源:origin: redisson/redisson

@SchedulerSupport(SchedulerSupport.NONE)
@Override
public final void subscribe(Observer<? super T> observer) {
  ObjectHelper.requireNonNull(observer, "observer is null");
  try {
    observer = RxJavaPlugins.onSubscribe(this, observer);
    ObjectHelper.requireNonNull(observer, "Plugin returned null Observer");
    subscribeActual(observer);
  } catch (NullPointerException e) { // NOPMD
    throw e;
  } catch (Throwable e) {
    Exceptions.throwIfFatal(e);
    // can't call onError because no way to know if a Disposable has been set or not
    // can't call onSubscribe because the call might have set a Subscription already
    RxJavaPlugins.onError(e);
    NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
    npe.initCause(e);
    throw npe;
  }
}

代码示例来源:origin: halfhp/rxtracer

@Override
protected void subscribeActual(io.reactivex.Observer<? super T> observer) {
  wrapped.subscribeActual(new ObserverWrapper<>(observer));
}

相关文章

Observable类方法