本文整理了Java中reactor.core.publisher.Operators.toCoreSubscriber()
方法的一些代码示例,展示了Operators.toCoreSubscriber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operators.toCoreSubscriber()
方法的具体详情如下:
包路径:reactor.core.publisher.Operators
类名称:Operators
方法名:toCoreSubscriber
[英]If the actual Subscriber is not a CoreSubscriber, it will apply safe strict wrapping to apply all reactive streams rules including the ones relaxed by internal operators based on CoreSubscriber.
[中]如果实际用户不是CoreSubscriber,它将应用安全严格包装来应用所有反应流规则,包括内部运营商基于CoreSubscriber放松的规则。
代码示例来源:origin: lettuce-io/lettuce-core
public PublishOnSubscriber(Subscriber<T> delegate, Executor executor) {
this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate);
this.executor = executor;
}
代码示例来源:origin: lettuce-io/lettuce-core
public ImmediateSubscriber(Subscriber<T> delegate) {
this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate);
}
代码示例来源:origin: reactor/reactor-core
@Override
public final void subscribe(Subscriber<? super T> actual) {
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual));
}
代码示例来源:origin: reactor/reactor-core
@Override
public final void subscribe(Subscriber<? super T> actual) {
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual));
}
代码示例来源:origin: reactor/reactor-core
/**
* Merge the rails into a {@link #sequential()} Flux and
* {@link Flux#subscribe(Subscriber) subscribe} to said Flux.
*
* @param s the subscriber to use on {@link #sequential()} Flux
*/
@Override
@SuppressWarnings("unchecked")
public final void subscribe(Subscriber<? super T> s) {
Flux.onLastAssembly(sequential())
.subscribe(new FluxHide.SuppressFuseableSubscriber<>(Operators.toCoreSubscriber(s)));
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Mono} and <strong>block</strong> until a next signal is
* received, the Mono completes empty or a timeout expires. Returns an {@link Optional}
* for the first two cases, which can be used to replace the empty case with an
* Exception via {@link Optional#orElseThrow(Supplier)}.
* In case the Mono itself errors, the original exception is thrown (wrapped in a
* {@link RuntimeException} if it was a checked exception).
* If the provided timeout expires, a {@link RuntimeException} is thrown.
*
* <p>
* <img class="marble" src="doc-files/marbles/blockOptionalWithTimeout.svg" alt="">
* <p>
* Note that each block() will trigger a new subscription: in other words, the result
* might miss signal from hot publishers.
*
* @param timeout maximum time period to wait for before raising a {@link RuntimeException}
*
* @return T the result
*/
public Optional<T> blockOptional(Duration timeout) {
BlockingOptionalMonoSubscriber<T> subscriber = new BlockingOptionalMonoSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet(timeout.toMillis(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Flux} and <strong>block</strong> until the upstream
* signals its first value, completes or a timeout expires. Returns that value,
* or null if the Flux completes empty. In case the Flux errors, the original
* exception is thrown (wrapped in a {@link RuntimeException} if it was a checked
* exception). If the provided timeout expires,a {@link RuntimeException} is thrown.
* <p>
* Note that each blockFirst() will trigger a new subscription: in other words,
* the result might miss signal from hot publishers.
*
* <p>
* <img class="marble" src="doc-files/marbles/blockFirstWithTimeout.svg" alt="">
*
* @param timeout maximum time period to wait for before raising a {@link RuntimeException}
* @return the first value or null
*/
@Nullable
public final T blockFirst(Duration timeout) {
BlockingFirstSubscriber<T> subscriber = new BlockingFirstSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet(timeout.toMillis(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Flux} and <strong>block</strong> until the upstream
* signals its last value, completes or a timeout expires. Returns that value,
* or null if the Flux completes empty. In case the Flux errors, the original
* exception is thrown (wrapped in a {@link RuntimeException} if it was a checked
* exception). If the provided timeout expires,a {@link RuntimeException} is thrown.
* <p>
* Note that each blockLast() will trigger a new subscription: in other words,
* the result might miss signal from hot publishers.
*
* <p>
* <img class="marble" src="doc-files/marbles/blockLastWithTimeout.svg" alt="">
*
* @param timeout maximum time period to wait for before raising a {@link RuntimeException}
* @return the last value or null
*/
@Nullable
public final T blockLast(Duration timeout) {
BlockingLastSubscriber<T> subscriber = new BlockingLastSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet(timeout.toMillis(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Mono} and <strong>block indefinitely</strong> until a next signal is
* received or the Mono completes empty. Returns an {@link Optional}, which can be used
* to replace the empty case with an Exception via {@link Optional#orElseThrow(Supplier)}.
* In case the Mono itself errors, the original exception is thrown (wrapped in a
* {@link RuntimeException} if it was a checked exception).
*
* <p>
* <img class="marble" src="doc-files/marbles/blockOptional.svg" alt="">
* <p>
* Note that each blockOptional() will trigger a new subscription: in other words, the result
* might miss signal from hot publishers.
*
* @return T the result
*/
public Optional<T> blockOptional() {
BlockingOptionalMonoSubscriber<T> subscriber = new BlockingOptionalMonoSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet();
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Mono} and <strong>block</strong> until a next signal is
* received or a timeout expires. Returns that value, or null if the Mono completes
* empty. In case the Mono errors, the original exception is thrown (wrapped in a
* {@link RuntimeException} if it was a checked exception).
* If the provided timeout expires,a {@link RuntimeException} is thrown.
*
* <p>
* <img class="marble" src="doc-files/marbles/blockWithTimeout.svg" alt="">
* <p>
* Note that each block() will trigger a new subscription: in other words, the result
* might miss signal from hot publishers.
*
* @param timeout maximum time period to wait for before raising a {@link RuntimeException}
*
* @return T the result
*/
@Nullable
public T block(Duration timeout) {
BlockingMonoSubscriber<T> subscriber = new BlockingMonoSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet(timeout.toMillis(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Mono} and <strong>block indefinitely</strong> until a next signal is
* received. Returns that value, or null if the Mono completes empty. In case the Mono
* errors, the original exception is thrown (wrapped in a {@link RuntimeException} if
* it was a checked exception).
*
* <p>
* <img class="marble" src="doc-files/marbles/block.svg" alt="">
* <p>
* Note that each block() will trigger a new subscription: in other words, the result
* might miss signal from hot publishers.
*
* @return T the result
*/
@Nullable
public T block() {
BlockingMonoSubscriber<T> subscriber = new BlockingMonoSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet();
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Flux} and <strong>block indefinitely</strong>
* until the upstream signals its first value or completes. Returns that value,
* or null if the Flux completes empty. In case the Flux errors, the original
* exception is thrown (wrapped in a {@link RuntimeException} if it was a checked
* exception).
* <p>
* Note that each blockFirst() will trigger a new subscription: in other words,
* the result might miss signal from hot publishers.
*
* <p>
* <img class="marble" src="doc-files/marbles/blockFirst.svg" alt="">
*
* @return the first value or null
*/
@Nullable
public final T blockFirst() {
BlockingFirstSubscriber<T> subscriber = new BlockingFirstSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet();
}
代码示例来源:origin: reactor/reactor-core
/**
* Subscribe to this {@link Flux} and <strong>block indefinitely</strong>
* until the upstream signals its last value or completes. Returns that value,
* or null if the Flux completes empty. In case the Flux errors, the original
* exception is thrown (wrapped in a {@link RuntimeException} if it was a checked
* exception).
* <p>
* Note that each blockLast() will trigger a new subscription: in other words,
* the result might miss signal from hot publishers.
*
* <p>
* <img class="marble" src="doc-files/marbles/blockLast.svg" alt="">
*
* @return the last value or null
*/
@Nullable
public final T blockLast() {
BlockingLastSubscriber<T> subscriber = new BlockingLastSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet();
}
代码示例来源:origin: io.lettuce/lettuce-core
public PublishOnSubscriber(Subscriber<T> delegate, Executor executor) {
this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate);
this.executor = executor;
}
代码示例来源:origin: io.lettuce/lettuce-core
public ImmediateSubscriber(Subscriber<T> delegate) {
this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate);
}
代码示例来源:origin: io.projectreactor/reactor-core
@Override
public final void subscribe(Subscriber<? super T> actual) {
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual));
}
代码示例来源:origin: io.projectreactor/reactor-core
@Override
public final void subscribe(Subscriber<? super T> actual) {
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual));
}
代码示例来源:origin: io.projectreactor/reactor-core
/**
* Merge the rails into a {@link #sequential()} Flux and
* {@link Flux#subscribe(Subscriber) subscribe} to said Flux.
*
* @param s the subscriber to use on {@link #sequential()} Flux
*/
@Override
@SuppressWarnings("unchecked")
public final void subscribe(Subscriber<? super T> s) {
Flux.onLastAssembly(sequential())
.subscribe(new FluxHide.SuppressFuseableSubscriber<>(Operators.toCoreSubscriber(s)));
}
代码示例来源:origin: io.projectreactor/reactor-core
/**
* Subscribe to this {@link Mono} and <strong>block indefinitely</strong> until a next signal is
* received or the Mono completes empty. Returns an {@link Optional}, which can be used
* to replace the empty case with an Exception via {@link Optional#orElseThrow(Supplier)}.
* In case the Mono itself errors, the original exception is thrown (wrapped in a
* {@link RuntimeException} if it was a checked exception).
*
* <p>
* <img class="marble" src="doc-files/marbles/blockOptional.svg" alt="">
* <p>
* Note that each blockOptional() will trigger a new subscription: in other words, the result
* might miss signal from hot publishers.
*
* @return T the result
*/
public Optional<T> blockOptional() {
BlockingOptionalMonoSubscriber<T> subscriber = new BlockingOptionalMonoSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet();
}
代码示例来源:origin: io.projectreactor/reactor-core
/**
* Subscribe to this {@link Mono} and <strong>block indefinitely</strong> until a next signal is
* received. Returns that value, or null if the Mono completes empty. In case the Mono
* errors, the original exception is thrown (wrapped in a {@link RuntimeException} if
* it was a checked exception).
*
* <p>
* <img class="marble" src="doc-files/marbles/block.svg" alt="">
* <p>
* Note that each block() will trigger a new subscription: in other words, the result
* might miss signal from hot publishers.
*
* @return T the result
*/
@Nullable
public T block() {
BlockingMonoSubscriber<T> subscriber = new BlockingMonoSubscriber<>();
onLastAssembly(this).subscribe(Operators.toCoreSubscriber(subscriber));
return subscriber.blockingGet();
}
内容来源于网络,如有侵权,请联系作者删除!