当前位置: 首页>>代码示例>>Java>>正文


Java ObservableEmitter.onError方法代码示例

本文整理汇总了Java中io.reactivex.ObservableEmitter.onError方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableEmitter.onError方法的具体用法?Java ObservableEmitter.onError怎么用?Java ObservableEmitter.onError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.reactivex.ObservableEmitter的用法示例。


在下文中一共展示了ObservableEmitter.onError方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(ObservableEmitter<T> subscriber) throws Exception {
    try {
        T data = execute();
        if (!subscriber.isDisposed() && data != null) {
            subscriber.onNext(data);
        }
    } catch (Throwable e) {
        ViseLog.e(e);
        Exceptions.throwIfFatal(e);
        if (!subscriber.isDisposed()) {
            subscriber.onError(e);
        }
        return;
    }
    if (!subscriber.isDisposed()) {
        subscriber.onComplete();
    }
}
 
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:20,代码来源:ApiCache.java

示例2: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(@NonNull ObservableEmitter<T> subscriber) throws Exception {
    try {
        T data = execute();
        if (!subscriber.isDisposed()) {
            subscriber.onNext(data);
        }
    } catch (Throwable e) {
        HttpLog.e(e.getMessage());
        if (!subscriber.isDisposed()) {
            subscriber.onError(e);
        }
        Exceptions.throwIfFatal(e);
        //RxJavaPlugins.onError(e);
        return;
    }

    if (!subscriber.isDisposed()) {
        subscriber.onComplete();
    }
}
 
开发者ID:zhou-you,项目名称:RxEasyHttp,代码行数:22,代码来源:RxCache.java

示例3: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final ObservableEmitter<DocumentSnapshot> emitter) throws Exception {
    final EventListener<DocumentSnapshot> listener = new EventListener<DocumentSnapshot>() {
        @Override
        public void onEvent(DocumentSnapshot documentSnapshot, FirebaseFirestoreException e) {
            if (!emitter.isDisposed()) {
                if (e == null) {
                    emitter.onNext(documentSnapshot);
                } else {
                    emitter.onError(e);
                }
            }
        }

    };

    registration = documentReference.addSnapshotListener(listener);

    emitter.setDisposable(Disposables.fromAction(new Action() {
        @Override
        public void run() throws Exception {
            registration.remove();
        }
    }));
}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:26,代码来源:DocumentSnapshotsOnSubscribe.java

示例4: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override public void subscribe(final ObservableEmitter<DataSnapshot> emitter) {
  final ValueEventListener listener = new ValueEventListener() {
    @Override public void onDataChange(DataSnapshot dataSnapshot) {
      if (!emitter.isDisposed()) {
        emitter.onNext(dataSnapshot);
      }
    }

    @Override public void onCancelled(DatabaseError databaseError) {
      if (!emitter.isDisposed()) {
        emitter.onError(databaseError.toException());
      }
    }
  };

  ref.addValueEventListener(listener);
  emitter.setDisposable(Disposables.fromAction(new Action() {
    @Override public void run() throws Exception {
      ref.removeEventListener(listener);
    }
  }));
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:23,代码来源:DataChangesOnSubscribe.java

示例5: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(ObservableEmitter<T> subscriber) throws Exception {
    try {
        T data = execute();
        if (!subscriber.isDisposed() && data != null) {
            subscriber.onNext(data);
        }
    } catch (Throwable e) {

        Exceptions.throwIfFatal(e);
        if (!subscriber.isDisposed()) {
            subscriber.onError(e);
        }
        return;
    }
    if (!subscriber.isDisposed()) {
        subscriber.onComplete();
    }
}
 
开发者ID:qiaodashaoye,项目名称:SuperHttp,代码行数:20,代码来源:ApiCache.java

示例6: doCall

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
private void doCall(GeneralObservableCallback callback, ObservableEmitter<Object> emitter) {
    if (callback != null) {
        try {
            callback.call();
        } catch (Exception e) {
            emitter.onError(e);
        }
    }
    emitter.onNext(object);
    emitter.onComplete();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:RxDownload.java

示例7: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final ObservableEmitter<QuerySnapshot> emitter) throws Exception {
    final EventListener<QuerySnapshot> listener = new EventListener<QuerySnapshot>() {
        @Override
        public void onEvent(QuerySnapshot querySnapshot, FirebaseFirestoreException e) {

            if (!emitter.isDisposed()) {
                if (e == null) {
                    emitter.onNext(querySnapshot);
                } else {
                    emitter.onError(e);
                }
            }

        }
    };

    registration = query.addSnapshotListener(listener);

    emitter.setDisposable(Disposables.fromAction(new Action() {
        @Override
        public void run() throws Exception {
            registration.remove();
        }
    }));

}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:28,代码来源:QuerySnapshotsOnSubscribe.java

示例8: subscribe

import io.reactivex.ObservableEmitter; //导入方法依赖的package包/类
@Override
public void subscribe(final ObservableEmitter<DocumentChange> emitter) throws Exception {
    final EventListener<QuerySnapshot> listener = new EventListener<QuerySnapshot>() {
        @Override
        public void onEvent(QuerySnapshot querySnapshot, FirebaseFirestoreException e) {

            if (!emitter.isDisposed()) {
                if (e == null) {
                    for (DocumentChange change : querySnapshot.getDocumentChanges()) {
                        emitter.onNext(change);
                    }

                } else {
                    emitter.onError(e);
                }
            }

        }
    };

    registration = query.addSnapshotListener(listener);

    emitter.setDisposable(Disposables.fromAction(new Action() {
        @Override
        public void run() throws Exception {
            registration.remove();
        }
    }));
}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:30,代码来源:DocumentChangesOnSubscribe.java


注:本文中的io.reactivex.ObservableEmitter.onError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。