reactor.core.publisher.Flux.onLastAssembly()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(227)

本文整理了Java中reactor.core.publisher.Flux.onLastAssembly()方法的一些代码示例,展示了Flux.onLastAssembly()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flux.onLastAssembly()方法的具体详情如下:
包路径:reactor.core.publisher.Flux
类名称:Flux
方法名:onLastAssembly

Flux.onLastAssembly介绍

[英]To be used by custom operators: invokes assembly Hooks pointcut given a Flux, potentially returning a new Flux. This is for example useful to activate cross-cutting concerns at assembly time, eg. a generalized #checkpoint().
[中]供自定义运算符使用:调用给定通量的程序集钩子切入点,可能返回新通量。例如,这对于在组装时激活横切关注点非常有用,例如,广义的#checkpoint()。

代码示例

代码示例来源: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 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 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.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 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: io.projectreactor/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: io.projectreactor/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: io.projectreactor/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();
}

相关文章

微信公众号

最新文章

更多

Flux类方法