记一个用RxJava遇到的问题
2016-01-12 15:22
561 查看
问题的现象是Observer的onNext方法被调用后,它的onError方法也紧跟着被调用了……我的第一反应是RxJava的Bug?……
当然不是的……
// handle errors if the onNext implementation fails, not just if the Observable fails
当onNext里我们的函数发生异常时,onError会被调用
当然不是的……
@Override public void onNext(T args) { try { if (!done) { actual.onNext(args); } } catch (Throwable e) { // we handle here instead of another method so we don't add stacks to the frame // which can prevent it from being able to handle StackOverflow Exceptions.throwIfFatal(e); // handle errors if the onNext implementation fails, not just if the Observable fails onError(e); } }
// handle errors if the onNext implementation fails, not just if the Observable fails
当onNext里我们的函数发生异常时,onError会被调用
相关文章推荐
- ArcGIS Server for Java
- 【Java基础】动态代理实现AOP之控制事务
- java数据库连接池技术
- Eclipse 默认设置的换行字符长度
- SpringMVC,Mybatis,Spring
- 深入学习Struts2
- UDP通信 Java
- Spring事务配置的五种方式
- java 简单jdbc
- Table布局
- Spring的scope属性
- Java设计模式中类的关系
- java 使用log4j 日志模块
- spring 注解@Resource 和 @Autowired的区别
- 关于android stuido 与 Eclipse 的android项目结构对比
- 通过生活中例子模拟java面向接口编程实例
- Spring - 基于注解的组件扫描
- 使用eclipse构建maven的web项目
- Java读取文件MD5的两种方案
- 文档翻译1:RxJava 简介