本文整理了Java中reactor.core.publisher.Operators.replace()
方法的一些代码示例,展示了Operators.replace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operators.replace()
方法的具体详情如下:
包路径:reactor.core.publisher.Operators
类名称:Operators
方法名:replace
[英]A generic utility to atomically replace a subscription or cancel the replacement if the current subscription is marked as already cancelled (as in #cancelledSubscription()).
[中]一个通用实用程序,用于自动替换订阅或在当前订阅被标记为已取消时取消替换(如#cancelled subscription()中)。
代码示例来源:origin: reactor/reactor-core
@Override
public void onSubscribe(Subscription s) {
if (Operators.replace(S, this, s)) {
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onNext(T t) {
long idx = INDEX.incrementAndGet(this);
if (!Operators.set(OTHER, this, Operators.emptySubscription())) {
return;
}
Publisher<U> p;
try {
p = Objects.requireNonNull(throttler.apply(t),
"throttler returned a null publisher");
}
catch (Throwable e) {
onError(Operators.onOperatorError(s, e, t, ctx));
return;
}
SampleTimeoutOther<T, U> os = new SampleTimeoutOther<>(this, t, idx);
if (Operators.replace(OTHER, this, os)) {
p.subscribe(os);
}
}
代码示例来源:origin: reactor/reactor-core
if (Operators.replace(OTHER, this, other)) {
p.subscribe(other);
代码示例来源:origin: io.projectreactor/reactor-core
@Override
public void onSubscribe(Subscription s) {
if (Operators.replace(S, this, s)) {
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: io.projectreactor/reactor-core
@Override
public void onNext(T t) {
long idx = INDEX.incrementAndGet(this);
if (!Operators.set(OTHER, this, Operators.emptySubscription())) {
return;
}
Publisher<U> p;
try {
p = Objects.requireNonNull(throttler.apply(t),
"throttler returned a null publisher");
}
catch (Throwable e) {
onError(Operators.onOperatorError(s, e, t, ctx));
return;
}
SampleTimeoutOther<T, U> os = new SampleTimeoutOther<>(this, t, idx);
if (Operators.replace(OTHER, this, os)) {
p.subscribe(os);
}
}
代码示例来源:origin: io.projectreactor/reactor-core
if (Operators.replace(OTHER, this, other)) {
p.subscribe(other);
内容来源于网络,如有侵权,请联系作者删除!