本文整理了Java中reactor.core.publisher.Operators.onNextDropped()
方法的一些代码示例,展示了Operators.onNextDropped()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operators.onNextDropped()
方法的具体详情如下:
包路径:reactor.core.publisher.Operators
类名称:Operators
方法名:onNextDropped
[英]An unexpected event is about to be dropped.
If no hook is registered for Hooks#onNextDropped(Consumer), the dropped element is just logged at DEBUG level.
[中]一个意外事件即将取消。
如果没有为Hooks#onNextDropped(Consumer)注册钩子,则删除的元素只会在调试级别记录。
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
synchronized (this) {
C b = buffer;
if (b != null) {
b.add(t);
return;
}
}
Operators.onNextDropped(t, this.ctx);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, context);
return;
}
value = t;
done = true;
drain();
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
Objects.requireNonNull(t, "t");
DirectInner<T>[] inners = subscribers;
if (inners == TERMINATED) {
Operators.onNextDropped(t, currentContext());
return;
}
for (DirectInner<T> s : inners) {
s.onNext(t);
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, actual.currentContext());
return;
}
synchronized (this) {
queue.offer(t);
}
drain();
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, parent.currentContext());
return;
}
done = true;
this.parent.complete(t);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T ev) {
if(terminalSignal != null){
Operators.onNextDropped(ev, this.cachedContext);
return;
}
produced++;
actual.onNext(Signal.next(ev, this.cachedContext));
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(R t) {
if (done) {
Operators.onNextDropped(t, parent.currentContext());
return;
}
done = true;
this.parent.complete(t);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
Subscription s = ref.getAndSet(null);
if (s != null) {
complete(t);
s.cancel();
}
else {
Operators.onNextDropped(t, currentContext());
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, actual.currentContext());
return;
}
value = t;
if (++count > 1) {
cancel();
onError(new IndexOutOfBoundsException("Source emitted more than one item"));
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, parent.currentContext());
return;
}
done = true;
Operators.terminate(S, this);
parent.next(t, index);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
this.malformedSourceCounter.increment();
Operators.onNextDropped(t, actual.currentContext());
return;
}
actual.onNext(t);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, actual.currentContext());
return;
}
try {
accumulator.accept(container, t);
}
catch (Throwable ex) {
onError(Operators.onOperatorError(s, ex, t, actual.currentContext()));
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, actual.currentContext());
return;
}
try {
action.accept(value, t);
}
catch (Throwable e) {
onError(Operators.onOperatorError(this, e, t, actual.currentContext()));
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, actual.currentContext());
return;
}
try {
collector.accept(collection, t);
}
catch (Throwable ex) {
onError(Operators.onOperatorError(this, ex, t, actual.currentContext()));
}
}
代码示例来源:origin: reactor/reactor-core
@Test
public void onNextDroppedLocal() {
AtomicReference<Object> hookState = new AtomicReference<>();
Consumer<Object> localHook = hookState::set;
Context c = Context.of(Hooks.KEY_ON_NEXT_DROPPED, localHook);
Operators.onNextDropped("foo", c);
assertThat(hookState.get()).isEqualTo("foo");
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
Operators.onNextDropped(t, actual.currentContext());
return;
}
s.cancel();
actual.onNext(t);
onComplete();
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(final T t) {
if (done || delayed < 0) {
Operators.onNextDropped(t, currentContext());
return;
}
//keep track of the number of delayed onNext so that
//we can also delay onError/onComplete when an onNext
//is "in flight"
DELAYED.incrementAndGet(this);
w.schedule(() -> delayedNext(t), delay, timeUnit);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
ReplayBuffer<T> b = buffer;
if (b.isDone()) {
Operators.onNextDropped(t, currentContext());
}
else {
b.add(t);
for (ReplaySubscription<T> rs : subscribers) {
b.replay(rs);
}
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
if (done) {
this.malformedSourceCounter.increment();
Operators.onNextDropped(t, actual.currentContext());
return;
}
//record the delay since previous onNext/onSubscribe. This also records the count.
long last = this.lastNextEventNanos;
this.lastNextEventNanos = clock.monotonicTime();
this.onNextIntervalTimer.record(lastNextEventNanos - last, TimeUnit.NANOSECONDS);
actual.onNext(t);
}
代码示例来源:origin: reactor/reactor-core
/**
* Helper for other tests to emulate resumeDrop with the public consumer-based API.
*/
public static <T> void drop(@Nullable Throwable e, @Nullable T v) {
if (v != null) {
Operators.onNextDropped(v, Context.empty());
}
if (e != null) {
Operators.onErrorDropped(e, Context.empty());
}
}
内容来源于网络,如有侵权,请联系作者删除!