本文整理了Java中reactor.core.publisher.Operators.complete()
方法的一些代码示例,展示了Operators.complete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operators.complete()
方法的具体详情如下:
包路径:reactor.core.publisher.Operators
类名称:Operators
方法名:complete
[英]Calls onSubscribe on the target Subscriber with the empty instance followed by a call to onComplete.
[中]Calls onSubscribe在目标订阅服务器上使用空实例,然后调用onComplete。
代码示例来源:origin: reactor/reactor-core
@Override
public void subscribe(CoreSubscriber<? super Object> actual) {
Operators.complete(actual);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void subscribe(CoreSubscriber<? super Object> actual) {
Operators.complete(actual);
}
代码示例来源:origin: reactor/reactor-core
@Override
public void subscribe(CoreSubscriber<? super T> actual) {
try {
run.run();
} catch (Throwable ex) {
Operators.error(actual, Operators.onOperatorError(ex, actual.currentContext()));
return;
}
Operators.complete(actual);
}
代码示例来源:origin: reactor/reactor-core
@SuppressWarnings("unchecked")
@Override
public void onSubscribe(Subscription s) {
if (Operators.validate(this.qs, s)) {
if (n == 0) {
s.cancel();
done = true;
Operators.complete(actual);
}
else {
this.qs = (QueueSubscription<T>) s;
actual.onSubscribe(this);
}
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void subscribe(CoreSubscriber<? super T> actual) {
if (state == STATE_INIT && STATE.compareAndSet(this, STATE_INIT, STATE_SUBSCRIBED_ONCE)) {
if (first == null && done) {
if (throwable != null) {
Operators.error(actual, throwable);
}
else {
Operators.complete(actual);
}
return;
}
INNER.lazySet(this, actual);
actual.onSubscribe(this);
}
else {
Operators.error(actual, new IllegalStateException("FluxSwitchOnFirst allows only one Subscriber"));
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onSubscribe(Subscription s) {
if (Operators.validate(this.s, s)) {
if (n == 0) {
s.cancel();
done = true;
Operators.complete(actual);
}
else {
this.s = s;
actual.onSubscribe(this);
}
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onComplete() {
if (main == null) {
if (MAIN.compareAndSet(this, null, Operators.cancelledSubscription())) {
cancelOther();
Operators.complete(actual);
return;
}
}
cancel();
actual.onComplete();
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void onSubscribe(Subscription s) {
if (Operators.validate(this.s, s)) {
if (n == 0) {
s.cancel();
done = true;
Operators.complete(actual);
}
else {
this.s = s;
actual.onSubscribe(this);
}
}
}
代码示例来源:origin: reactor/reactor-core
void otherComplete() {
if (otherValue == null) {
if (main == null) {
if (MAIN.compareAndSet(this,
null,
Operators.cancelledSubscription())) {
cancelMain();
Operators.complete(actual);
return;
}
}
cancelMain();
actual.onComplete();
}
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void subscribe(CoreSubscriber<? super T> actual) {
if (state == STATE_INIT && STATE.compareAndSet(this, STATE_INIT, STATE_SUBSCRIBED_ONCE)) {
if (first == null && done) {
if (throwable != null) {
Operators.error(actual, throwable);
}
else {
Operators.complete(actual);
}
return;
}
INNER.lazySet(this, Operators.toConditionalSubscriber(actual));
actual.onSubscribe(this);
}
else {
Operators.error(actual, new IllegalStateException("FluxSwitchOnFirst allows only one Subscriber"));
}
}
代码示例来源:origin: reactor/reactor-core
Operators.complete(actual);
return;
代码示例来源:origin: reactor/reactor-core
@SuppressWarnings("unchecked")
public static <T> void subscribe(CoreSubscriber<? super T> s, T[] array) {
if (array.length == 0) {
Operators.complete(s);
return;
}
if (s instanceof ConditionalSubscriber) {
s.onSubscribe(new ArrayConditionalSubscription<>((ConditionalSubscriber<? super T>) s, array));
}
else {
s.onSubscribe(new ArraySubscription<>(s, array));
}
}
代码示例来源:origin: reactor/reactor-core
@Override
public void subscribe(CoreSubscriber<? super R> actual) {
Iterator<? extends U> it;
try {
it = Objects.requireNonNull(other.iterator(),
"The other iterable produced a null iterator");
}
catch (Throwable e) {
Operators.error(actual, Operators.onOperatorError(e, actual.currentContext()));
return;
}
boolean b;
try {
b = it.hasNext();
}
catch (Throwable e) {
Operators.error(actual, Operators.onOperatorError(e, actual.currentContext()));
return;
}
if (!b) {
Operators.complete(actual);
return;
}
source.subscribe(new ZipSubscriber<>(actual, it, zipper));
}
代码示例来源:origin: reactor/reactor-core
@Override
@SuppressWarnings("unchecked")
public void subscribe(CoreSubscriber<? super T> actual) {
if (resourceSupplier instanceof Callable) {
try {
Callable<S> resourceCallable = (Callable<S>) resourceSupplier;
S resource = resourceCallable.call();
if (resource == null) {
Operators.complete(actual);
}
else {
final Mono<? extends T> p = deriveMonoFromResource(resource, resourceClosure);
final UsingWhenSubscriber<? super T, S> subscriber = prepareSubscriberForResource(resource,
actual,
asyncComplete,
asyncError,
asyncCancel,
null);
p.subscribe(subscriber);
}
}
catch (Throwable e) {
Operators.error(actual, e);
}
return;
}
resourceSupplier.subscribe(new ResourceSubscriber(actual, resourceClosure,
asyncComplete, asyncError, asyncCancel,
resourceSupplier instanceof Mono));
}
代码示例来源:origin: reactor/reactor-core
@Override
@SuppressWarnings("unchecked")
public void subscribe(CoreSubscriber<? super Integer> actual) {
long st = start;
long en = end;
if (st == en) {
Operators.complete(actual);
return;
} else
if (st + 1 == en) {
actual.onSubscribe(Operators.scalarSubscription(actual, (int)st));
return;
}
if (actual instanceof ConditionalSubscriber) {
actual.onSubscribe(new RangeSubscriptionConditional((ConditionalSubscriber<? super Integer>) actual, st, en));
return;
}
actual.onSubscribe(new RangeSubscription(actual, st, en));
}
代码示例来源:origin: reactor/reactor-core
@Test
public void prematureCompleteSourceEmptyDouble() {
DirectProcessor<Integer> d = DirectProcessor.create();
StepVerifier.create(Flux.zip(obj -> 0, d, s -> {
CoreSubscriber<?> a =
((DirectProcessor.DirectInner) d.inners().findFirst().get())
.actual;
Operators.complete(s);
a.onComplete();
}, Mono.just(1)))
.verifyComplete();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void conditionalFusionAvailable() {
AssertSubscriber<Object> ts = AssertSubscriber.create();
Flux.wrap(u -> {
if (!(u instanceof Fuseable.ConditionalSubscriber)) {
Operators.error(u,
new IllegalArgumentException("The subscriber is not conditional: " + u));
}
else {
Operators.complete(u);
}
})
.doOnNext(v -> {
})
.filter(v -> true)
.subscribe(ts);
ts.assertNoError()
.assertNoValues()
.assertComplete();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void conditionalFusionAvailable() {
AssertSubscriber<Object> ts = AssertSubscriber.create();
Flux.from(u -> {
if (!(u instanceof Fuseable.ConditionalSubscriber)) {
Operators.error(u,
new IllegalArgumentException("The subscriber is not conditional: " + u));
}
else {
Operators.complete(u);
}
})
.doOnNext(v -> {
})
.filter(v -> true)
.subscribe(ts);
ts.assertNoError()
.assertNoValues()
.assertComplete();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void conditionalFusionAvailableWithFuseable() {
AssertSubscriber<Object> ts = AssertSubscriber.create();
Flux.wrap(u -> {
if (!(u instanceof Fuseable.ConditionalSubscriber)) {
Operators.error(u,
new IllegalArgumentException("The subscriber is not conditional: " + u));
}
else {
Operators.complete(u);
}
})
.doOnNext(v -> {
})
.filter(v -> true)
.subscribe(ts);
ts.assertNoError()
.assertNoValues()
.assertComplete();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void conditionalFusionAvailableWithFuseable() {
AssertSubscriber<Object> ts = AssertSubscriber.create();
Flux.wrap(u -> {
if (!(u instanceof Fuseable.ConditionalSubscriber)) {
Operators.error(u,
new IllegalArgumentException("The subscriber is not conditional: " + u));
}
else {
Operators.complete(u);
}
})
.doOnNext(v -> {
})
.filter(v -> true)
.subscribe(ts);
ts.assertNoError()
.assertNoValues()
.assertComplete();
}
内容来源于网络,如有侵权,请联系作者删除!