本文整理汇总了Java中io.reactivex.exceptions.UndeliverableException类的典型用法代码示例。如果您正苦于以下问题:Java UndeliverableException类的具体用法?Java UndeliverableException怎么用?Java UndeliverableException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UndeliverableException类属于io.reactivex.exceptions包,在下文中一共展示了UndeliverableException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDoesNotTwoErrorsIfUpstreamDoesNotHonourCancellationImmediately
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
@Test
public void testDoesNotTwoErrorsIfUpstreamDoesNotHonourCancellationImmediately() {
try {
List<Throwable> list = new CopyOnWriteArrayList<Throwable>();
RxJavaPlugins.setErrorHandler(Consumers.addTo(list));
Burst.items(1).error(new ThrowingException())//
.compose(Transformers. //
collectWhile( //
Callables.<List<Integer>>constant(Lists.<Integer>newArrayList()), ADD, //
BiPredicates.throwing())) //
.test() //
.assertNoValues() //
.assertError(ThrowingException.class);
assertEquals(1, list.size());
System.out.println(list.get(0));
assertTrue(list.get(0) instanceof UndeliverableException);
assertTrue(list.get(0).getCause() instanceof ThrowingException);
} finally {
RxJavaPlugins.reset();
}
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:22,代码来源:FlowableCollectWhileTest.java
示例2: onCreate
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
applicationComponent = buildApplicationComponent();
applicationComponent.inject(this);
StrictMode.enableDefaults();
if (analytics.isPresent()) {
analytics.get().init();
}
RxJavaPlugins.setErrorHandler(throwable -> {
if (throwable instanceof UndeliverableException && throwable.getCause() instanceof HttpException) {
//If there are many requests sent at once, first error is handler normally, the rest lands here
LibrusUtils.log("plugin handle");
LibrusUtils.log(throwable);
} else {
Thread currentThread = Thread.currentThread();
Thread.UncaughtExceptionHandler handler = currentThread.getUncaughtExceptionHandler();
handler.uncaughtException(currentThread, throwable);
}
});
}
开发者ID:shymmq,项目名称:librus-client,代码行数:25,代码来源:MainApplication.java
示例3: accept
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
@Override
public void accept(Throwable e) throws Exception {
if (e instanceof OnErrorNotImplementedException) {
Promise.error(e.getCause()).then(Action.noop());
} else if (e instanceof UndeliverableException) {
Promise.error(e.getCause()).then(Action.noop());
} else {
Promise.error(e).then(Action.noop());
}
}
开发者ID:drmaas,项目名称:ratpack-rx2,代码行数:11,代码来源:ErrorHandler.java
示例4: testPoolFactoryWhenFailsThenRecovers
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
@Test
public void testPoolFactoryWhenFailsThenRecovers() {
AtomicReference<Throwable> ex = new AtomicReference<>();
Consumer<? super Throwable> handler = RxJavaPlugins.getErrorHandler();
RxJavaPlugins.setErrorHandler(t -> ex.set(t));
try {
TestScheduler s = new TestScheduler();
AtomicInteger c = new AtomicInteger();
NonBlockingPool<Integer> pool = NonBlockingPool.factory(() -> {
if (c.getAndIncrement() == 0) {
throw new TestException();
} else {
return c.get();
}
}) //
.maxSize(1) //
.scheduler(s) //
.createRetryInterval(10, TimeUnit.SECONDS) //
.build();
TestObserver<Integer> ts = pool.member() //
.map(m -> m.value()) //
.test() //
.assertNotTerminated() //
.assertNoValues();
s.triggerActions();
assertTrue(ex.get() instanceof UndeliverableException);
assertTrue(((UndeliverableException) ex.get()).getCause() instanceof TestException);
s.advanceTimeBy(10, TimeUnit.SECONDS);
s.triggerActions();
ts.assertComplete();
ts.assertValue(2);
} finally {
RxJavaPlugins.setErrorHandler(handler);
}
}
开发者ID:davidmoten,项目名称:rxjava2-jdbc,代码行数:36,代码来源:NonBlockingPoolTest.java
示例5: isInterruptedIOException
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
static boolean isInterruptedIOException(Throwable e) {
// unwrap to see if this is an InterruptedIOException bubbled up from rx/okio
if (e instanceof UndeliverableException) {
if (e.getCause() != null && e.getCause() instanceof UncheckedIOException) {
if (e.getCause().getCause() != null &&
e.getCause().getCause() instanceof InterruptedIOException) {
return true;
}
}
}
return false;
}
开发者ID:dehora,项目名称:nakadi-java,代码行数:13,代码来源:ExceptionSupport.java
示例6: setupRxErrorHandler
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
private void setupRxErrorHandler() {
RxJavaPlugins.setErrorHandler(
t -> {
Throwable t0 = t;
if (t instanceof UndeliverableException) {
t0 = t.getCause();
}
if(this.failedProcessorException == null) {
this.failedProcessorException = t0;
}
if (t0 instanceof java.util.concurrent.RejectedExecutionException) {
// can happen with a processor stop and another start if the old one is interrupted
logger.debug("op=unhandled_rejected_execution action=continue {}", t0.getMessage());
} else {
if (t0 instanceof NonRetryableNakadiException) {
logger.error(String.format(
"op=unhandled_non_retryable_exception action=stopping type=NonRetryableNakadiException %s ",
((NonRetryableNakadiException) t0).problem()), t0);
stopStreaming();
} else if (t0 instanceof Error) {
logger.error(String.format(
"op=unhandled_error action=stopping type=NonRetryableNakadiException %s ",
t.getMessage()), t0);
stopStreaming();
} else {
logger.error(
String.format("unhandled_unknown_exception action=stopping type=%s %s",
t0.getClass().getSimpleName(), t0.getMessage()), t0);
stopStreaming();
}
}
}
);
}
开发者ID:dehora,项目名称:nakadi-java,代码行数:43,代码来源:StreamProcessor.java
示例7: takeThrowableFromUndeliverableException
import io.reactivex.exceptions.UndeliverableException; //导入依赖的package包/类
public Throwable takeThrowableFromUndeliverableException() {
Throwable error = take();
assertThat(error).isInstanceOf(UndeliverableException.class);
return error.getCause();
}
开发者ID:uber,项目名称:AutoDispose,代码行数:6,代码来源:RxErrorsRule.java
注:本文中的io.reactivex.exceptions.UndeliverableException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论