本文整理了Java中io.reactivex.common.Notification.isOnError()
方法的一些代码示例,展示了Notification.isOnError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.isOnError()
方法的具体详情如下:
包路径:io.reactivex.common.Notification
类名称:Notification
方法名:isOnError
[英]Returns true if this notification is an onError signal and #getError() returns the contained Throwable.
[中]如果此通知是OneError信号,则返回true,#getError()返回包含的可丢弃文件。
代码示例来源:origin: akarnokd/RxJava3-preview
@Override
public boolean test(Notification<Object> t) throws Exception {
return t.isOnError();
}
}
代码示例来源:origin: com.github.akarnokd.rxjava3/rxjava3-observable
@Override
public boolean test(Notification<Object> t) throws Exception {
return t.isOnError();
}
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Override
protected void onDrop(Notification<T> n) {
if (n.isOnError()) {
RxJavaCommonPlugins.onError(n.getError());
}
}
}
代码示例来源:origin: akarnokd/RxJava3-preview
@SuppressWarnings("rawtypes")
static String kind(Notification notification) {
if (notification.isOnError()) {
return "OnError";
}
if (notification.isOnNext()) {
return "OnNext";
}
return "OnComplete";
}
代码示例来源:origin: akarnokd/RxJava3-preview
@SuppressWarnings("rawtypes")
static String kind(Notification notification) {
if (notification.isOnError()) {
return "OnError";
}
if (notification.isOnNext()) {
return "OnNext";
}
return "OnComplete";
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Override
public boolean hasNext() {
if (iteratorNotification != null && iteratorNotification.isOnError()) {
throw ExceptionHelper.wrapOrThrow(iteratorNotification.getError());
}
if (iteratorNotification == null) {
try {
BlockingHelper.verifyNonBlocking();
notify.acquire();
} catch (InterruptedException ex) {
dispose();
iteratorNotification = Notification.createOnError(ex);
throw ExceptionHelper.wrapOrThrow(ex);
}
Notification<T> n = value.getAndSet(null);
iteratorNotification = n;
if (n.isOnError()) {
throw ExceptionHelper.wrapOrThrow(n.getError());
}
}
return iteratorNotification.isOnNext();
}
代码示例来源:origin: com.github.akarnokd.rxjava3/rxjava3-observable
@Override
public boolean hasNext() {
if (iteratorNotification != null && iteratorNotification.isOnError()) {
throw ExceptionHelper.wrapOrThrow(iteratorNotification.getError());
}
if (iteratorNotification == null) {
try {
BlockingHelper.verifyNonBlocking();
notify.acquire();
} catch (InterruptedException ex) {
dispose();
iteratorNotification = Notification.createOnError(ex);
throw ExceptionHelper.wrapOrThrow(ex);
}
Notification<T> n = value.getAndSet(null);
iteratorNotification = n;
if (n.isOnError()) {
throw ExceptionHelper.wrapOrThrow(n.getError());
}
}
return iteratorNotification.isOnNext();
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Override
public boolean hasNext() {
if (iteratorNotification != null && iteratorNotification.isOnError()) {
throw ExceptionHelper.wrapOrThrow(iteratorNotification.getError());
}
if (iteratorNotification == null || iteratorNotification.isOnNext()) {
if (iteratorNotification == null) {
try {
BlockingHelper.verifyNonBlocking();
notify.acquire();
} catch (InterruptedException ex) {
dispose();
iteratorNotification = Notification.createOnError(ex);
throw ExceptionHelper.wrapOrThrow(ex);
}
Notification<T> n = value.getAndSet(null);
iteratorNotification = n;
if (n.isOnError()) {
throw ExceptionHelper.wrapOrThrow(n.getError());
}
}
}
return iteratorNotification.isOnNext();
}
代码示例来源:origin: com.github.akarnokd.rxjava3/rxjava3-observable
@Override
public void onNext(Notification<T> t) {
if (done) {
if (t.isOnError()) {
RxJavaCommonPlugins.onError(t.getError());
}
return;
}
if (t.isOnError()) {
s.dispose();
onError(t.getError());
}
else if (t.isOnComplete()) {
s.dispose();
onComplete();
} else {
actual.onNext(t.getValue());
}
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Override
public void onNext(Notification<T> t) {
if (done) {
if (t.isOnError()) {
RxJavaCommonPlugins.onError(t.getError());
}
return;
}
if (t.isOnError()) {
s.cancel();
onError(t.getError());
}
else if (t.isOnComplete()) {
s.cancel();
onComplete();
} else {
actual.onNext(t.getValue());
}
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Override
public void onNext(Notification<T> t) {
if (done) {
if (t.isOnError()) {
RxJavaCommonPlugins.onError(t.getError());
}
return;
}
if (t.isOnError()) {
s.dispose();
onError(t.getError());
}
else if (t.isOnComplete()) {
s.dispose();
onComplete();
} else {
actual.onNext(t.getValue());
}
}
代码示例来源:origin: akarnokd/RxJava3-preview
return false;
if (nextNotification.isOnError()) {
error = nextNotification.getError();
throw ExceptionHelper.wrapOrThrow(error);
代码示例来源:origin: akarnokd/RxJava3-preview
@Test
public void testMaterialize1() {
// null will cause onError to be triggered before "three" can be
// returned
final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null,
"three");
TestLocalObserver observer = new TestLocalObserver();
Observable<Notification<String>> m = Observable.unsafeCreate(o1).materialize();
m.subscribe(observer);
try {
o1.t.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
assertFalse(observer.onError);
assertTrue(observer.onComplete);
assertEquals(3, observer.notifications.size());
assertTrue(observer.notifications.get(0).isOnNext());
assertEquals("one", observer.notifications.get(0).getValue());
assertTrue(observer.notifications.get(1).isOnNext());
assertEquals("two", observer.notifications.get(1).getValue());
assertTrue(observer.notifications.get(2).isOnError());
assertEquals(NullPointerException.class, observer.notifications.get(2).getError().getClass());
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Test
public void testMaterialize1() {
// null will cause onError to be triggered before "three" can be
// returned
final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null,
"three");
TestNotificationSubscriber observer = new TestNotificationSubscriber();
Flowable<Notification<String>> m = Flowable.unsafeCreate(o1).materialize();
m.subscribe(observer);
try {
o1.t.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
assertFalse(observer.onError);
assertTrue(observer.onComplete);
assertEquals(3, observer.notifications.size());
assertTrue(observer.notifications.get(0).isOnNext());
assertEquals("one", observer.notifications.get(0).getValue());
assertTrue(observer.notifications.get(1).isOnNext());
assertEquals("two", observer.notifications.get(1).getValue());
assertTrue(observer.notifications.get(2).isOnError());
assertEquals(NullPointerException.class, observer.notifications.get(2).getError().getClass());
}
代码示例来源:origin: akarnokd/RxJava3-preview
@Test
public void testBackpressureWithEmissionThenError() {
TestSubscriber<Notification<Integer>> ts = new TestSubscriber<Notification<Integer>>(0L);
IllegalArgumentException ex = new IllegalArgumentException();
Flowable.fromIterable(Arrays.asList(1)).concatWith(Flowable.<Integer> error(ex)).materialize()
.subscribe(ts);
ts.assertNoValues();
ts.request(1);
ts.assertValueCount(1);
assertTrue(ts.values().get(0).isOnNext());
ts.request(1);
ts.assertValueCount(2);
assertTrue(ts.values().get(1).isOnError());
assertEquals(ex, ts.values().get(1).getError());
ts.assertComplete();
}
内容来源于网络,如有侵权,请联系作者删除!