本文整理汇总了Java中io.reactivex.Flowable.onErrorResumeNext方法的典型用法代码示例。如果您正苦于以下问题:Java Flowable.onErrorResumeNext方法的具体用法?Java Flowable.onErrorResumeNext怎么用?Java Flowable.onErrorResumeNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Flowable
的用法示例。
在下文中一共展示了Flowable.onErrorResumeNext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public Flowable<Integer> delete(final List<T> items) {
List<Flowable<Integer>> flowables = new ArrayList<>();
Flowable<Integer> flowStorage = dao.delete(items);
if(hasSyncedStore()) {
flowStorage = flowStorage
.onErrorResumeNext(new Function<Throwable, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(final Throwable throwable) throws Exception {
return syncedStore.insertOrUpdate(items)
.flatMap(new Function<Optional<List<T>>, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Optional<List<T>> reinsertedItem) throws Exception {
return Flowable.error(throwable);
}
});
}
});
flowables.add(syncedStore.delete(items));
}
flowables.add(flowStorage);
return Flowable.concat(flowables);
}
示例2: deleteAll
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public Flowable<Integer> deleteAll() {
List<Flowable<Integer>> flowables = new ArrayList<>();
Flowable<Integer> flowStorage = dao.deleteAll();
// TODO improve the deleteAll method in case of double fail
// copy the syncedStore for insert if double fail
// execute the deleteAll (this)
// if error, try getAll()
// if error again => re-insert syncedStore datas (better than nothing)
// if not error, insert fresh datas
if(hasSyncedStore()) {
flowStorage = flowStorage
.onErrorResumeNext(new Function<Throwable, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(final Throwable throwable) throws Exception {
return dao.getAll(null, null)
.flatMap(new Function<Optional<List<T>>, Flowable<Optional<List<T>>>>() {
@Override
public Flowable<Optional<List<T>>> apply(final Optional<List<T>> items) throws Exception {
return syncedStore.insertOrUpdate(items.get());
}
})
.flatMap(new Function<Optional<List<T>>, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Optional<List<T>> reinsertedItems) throws Exception {
return Flowable.error(throwable);
}
});
}
});
flowables.add(syncedStore.deleteAll());
}
flowables.add(flowStorage);
return Flowable.concat(flowables);
}
示例3: apply
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override public Publisher<T> apply(Flowable<T> upstream) {
return upstream.onErrorResumeNext(this::handleErrorFromDeserializer);
}
开发者ID:ubiratansoares,项目名称:reactive-architectures-playground,代码行数:4,代码来源:DeserializationIssuesHandler.java
示例4: apply
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override public Publisher<T> apply(Flowable<T> upstream) {
return upstream.onErrorResumeNext(this::handleIfRestError);
}
示例5: apply
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override public Publisher<T> apply(Flowable<T> upstream) {
return upstream.onErrorResumeNext(this::handleIfNetworkingError);
}