本文整理了Java中reactor.core.Exceptions.failWithCancel()
方法的一些代码示例,展示了Exceptions.failWithCancel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exceptions.failWithCancel()
方法的具体详情如下:
包路径:reactor.core.Exceptions
类名称:Exceptions
方法名:failWithCancel
[英]An exception that is propagated upward and considered as "fatal" as per Reactive Stream limited list of exceptions allowed to bubble. It is not meant to be common error resolution but might assist implementors in dealing with boundaries (queues, combinations and async).
[中]根据允许冒泡的反应流限制异常列表,向上传播并被视为“致命”的异常。它不是用来解决常见错误的,但可能有助于实现者处理边界(队列、组合和异步)。
代码示例来源:origin: reactor/reactor-core
/**
* Resets {@link #resetOnNextDropped() onNextDropped hook(s)} and
* apply a strategy of throwing {@link Exceptions#failWithCancel()} instead.
* <p>
* Use {@link #resetOnNextDropped()} to reset to the default strategy of logging.
*/
public static void onNextDroppedFail() {
log.debug("Enabling failure mode for onNextDropped");
synchronized(log) {
onNextDroppedHook = n -> {throw Exceptions.failWithCancel();};
}
}
代码示例来源:origin: reactor/reactor-core
@Test
public void unwrapMultipleNotComposite() {
RuntimeException e1 = Exceptions.failWithCancel();
assertThat(Exceptions.unwrapMultiple(e1)).containsExactly(e1);
}
代码示例来源:origin: reactor/reactor-core
@Test
public void isMultiple() {
Exception e1 = new IllegalStateException("1");
Exception e2 = new IllegalArgumentException("2");
Exception composite = Exceptions.multiple(e1, e2);
assertThat(Exceptions.isMultiple(composite)).isTrue();
assertThat(Exceptions.isMultiple(Exceptions.failWithCancel())).isFalse();
assertThat(Exceptions.isMultiple(null)).isFalse();
}
代码示例来源:origin: reactor/reactor-core
throw Exceptions.failWithCancel();
});
processor.log("wqp.fail2").subscribe(d -> {
errorCount.incrementAndGet();
throw Exceptions.failWithCancel();
});
代码示例来源:origin: io.projectreactor/reactor-core
/**
* Resets {@link #resetOnNextDropped() onNextDropped hook(s)} and
* apply a strategy of throwing {@link Exceptions#failWithCancel()} instead.
* <p>
* Use {@link #resetOnNextDropped()} to reset to the default strategy of logging.
*/
public static void onNextDroppedFail() {
log.debug("Enabling failure mode for onNextDropped");
synchronized(log) {
onNextDroppedHook = n -> {throw Exceptions.failWithCancel();};
}
}
代码示例来源:origin: io.projectreactor/reactor-netty
return Mono.error(Exceptions.failWithCancel());
代码示例来源:origin: io.projectreactor/reactor-netty
@Override
protected Mono<Void> doStart(Function<? super Channel<ByteBuf, ByteBuf>, ? extends Publisher<Void>> handler) {
if (systemStats) {
UnicastProcessor<Event> p = UnicastProcessor.create();
this.cannons.submit(p);
log.info("System Monitoring Starting");
timer.schedulePeriodically(() -> {
if (!p.isCancelled()) {
p.onNext(lastSystemState.scan());
}
else {
log.info("System Monitoring Stopped");
throw Exceptions.failWithCancel();
}
}, 0L, systemStatsPeriod, TimeUnit.MILLISECONDS);
}
return server.start();
}
代码示例来源:origin: io.projectreactor/reactor-netty
/**
* @param o
* @param period
* @param unit
* @param <E>
*
* @return
*/
public final <E> E monitor(final E o, long period, TimeUnit unit) {
final long _period = period > 0 ? period : 400L;
UnicastProcessor<Object> p = UnicastProcessor.create();
log.info("State Monitoring Starting on " + FlowSerializerUtils.getName(o));
timer.schedulePeriodically(() -> {
if (!p.isCancelled()) {
p.onNext(FlowSerializerUtils.scan(o));
}
else {
log.info("State Monitoring stopping on " + FlowSerializerUtils.getName(o));
throw Exceptions.failWithCancel();
}
}, 0L, _period, unit != null ? unit : TimeUnit.MILLISECONDS);
this.cannons.submit(p.map(new GraphMapper()));
return o;
}
内容来源于网络,如有侵权,请联系作者删除!