public PublishOnSubscriber(Subscriber<T> delegate, Executor executor) { this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate); this.executor = executor; }
public ImmediateSubscriber(Subscriber<T> delegate) { this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate); }
@Override public final void subscribe(Subscriber<? super T> actual) { onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual)); }
@Override public final void subscribe(Subscriber<? super T> actual) { onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual)); }
/** * 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))); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(); }
/** * 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); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
public PublishOnSubscriber(Subscriber<T> delegate, Executor executor) { this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate); this.executor = executor; }
public ImmediateSubscriber(Subscriber<T> delegate) { this.delegate = (CoreSubscriber) reactor.core.publisher.Operators.toCoreSubscriber(delegate); }
@Override public final void subscribe(Subscriber<? super T> actual) { onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual)); }
@Override public final void subscribe(Subscriber<? super T> actual) { onLastAssembly(this).subscribe(Operators.toCoreSubscriber(actual)); }
/** * 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))); }
/** * 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(); }
/** * 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(); }