Package hu.akarnokd.rxjava3.basetypes
Class Solo<T>
- java.lang.Object
-
- hu.akarnokd.rxjava3.basetypes.Solo<T>
-
- Type Parameters:
T- the value type
- All Implemented Interfaces:
Publisher<T>
- Direct Known Subclasses:
SoloProcessor
public abstract class Solo<T> extends java.lang.Object implements Publisher<T>
Base class with fluent API for supporting a Publisher with exactly 1 element or an error.- Since:
- 0.13.0
-
-
Constructor Summary
Constructors Constructor Description Solo()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T> Solo<T>amb(java.lang.Iterable<? extends Solo<? extends T>> sources)Emit the events of the Solo that reacts first.static <T> Solo<T>ambArray(Solo<? extends T>... sources)Emit the events of the Solo that reacts first.Solo<T>ambWith(Solo<? extends T> other)Signal the events of this or the other Solo whichever signals first.Solo<T>andThen(Nono other)Run the given Nono after this Solo completes successfully and emit that original success value only if the Nono completes normally.Flowable<T>andThen(Publisher<? extends T> other)Emits the success value of this Solo and then continues with the events of the other Publisher.TblockingGet()Blockingly awaits indefinitely the success value of this Solo or rethrows its error (wrapped into a RuntimeException if necessary).TblockingGet(long timeout, java.util.concurrent.TimeUnit unit)Blockingly awaits at most the given timeout for the success value of this Solo or rethrows its error (wrapped into a RuntimeException if necessary).voidblockingSubscribe()Blocks until this Solo terminates and ignores the signals it produced.voidblockingSubscribe(Consumer<? super T> onNext)Blocks until this Solo terminates and calls the onNext with the success value.voidblockingSubscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError)Blocks until this solo terminates and calls the onNext with the success value or calls the onError with the error Throwable.voidblockingSubscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete)Blocks until this Solo produces its terminal signal and calls the appropriate callback(s) based on the signal type.Solo<T>cache()Caches the value or error event of the upstream Solo and relays/replays it to Subscribers.<R> Solo<R>compose(Function<? super Solo<T>,? extends Solo<R>> composer)Applies a function to this Solo and returns the Solo it returned.static <T> Flowable<T>concat(java.lang.Iterable<? extends Solo<? extends T>> sources)Concatenate the values in order from a sequence of Solo sources.static <T> Flowable<T>concat(Publisher<? extends Solo<? extends T>> sources)Concatenate the values in order from a sequence of Solo sources.static <T> Flowable<T>concat(Publisher<? extends Solo<? extends T>> sources, int prefetch)Concatenate the values in order from a sequence of Solo sources.static <T> Flowable<T>concatArray(Solo<? extends T>... sources)Concatenate the values in order from a sequence of Solo sources.static <T> Flowable<T>concatArrayDelayError(Solo<? extends T>... sources)Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>concatDelayError(java.lang.Iterable<? extends Solo<? extends T>> sources)Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>concatDelayError(Publisher<? extends Solo<? extends T>> sources)Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>concatDelayError(Publisher<? extends Solo<? extends T>> sources, int prefetch)Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>concatDelayError(Publisher<? extends Solo<? extends T>> sources, int prefetch, boolean tillTheEnd)Concatenate the values in order from a sequence of Solo sources, delaying errors till a source terminates or the whole sequence terminates.Flowable<T>concatWith(Solo<T> other)Emits the success value of this Solo followed by the event of the other Solo.static <T> Solo<T>create(SingleOnSubscribe<T> onCreate)Create a Solo that for each incoming Subscriber calls a callback to emit a sync or async events in a thread-safe, backpressure-aware and cancellation-safe manner.static <T> Solo<T>defer(Supplier<? extends Solo<T>> supplier)Defers the creation of the actual Solo to the time when a Subscriber subscribes to the returned Solo.Solo<T>delay(long delay, java.util.concurrent.TimeUnit unit)Delay the emission of the signal of this Solo with the specified time amount.Solo<T>delay(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)Delay the emission of the signal of this Solo with the specified time amount on the specified scheduler.Solo<T>delay(Publisher<?> other)Delay the emission of the signal until the other Publisher signals an item or completes.Solo<T>delaySubscription(long delay, java.util.concurrent.TimeUnit unit)Delay the subscription to this Solo until the specified delay elapses.Solo<T>delaySubscription(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)Delay the subscription to this Solo until the specified delay elapses.Solo<T>delaySubscription(Publisher<?> other)Delay the subscription to this Solo until the other Publisher signals a value or completes.Solo<T>doAfterNext(Consumer<? super T> onAfterNext)Executes a callback after the value is emitted to downstream.Solo<T>doAfterTerminate(Action onAfterTerminate)Executes the callback after this Solo terminates and the downstream is notified.Solo<T>doFinally(Action onFinally)Executes the callback exactly if the upstream terminates or the downstream cancels the sequence.Solo<T>doOnCancel(Action onCancel)Executes the callback if the downstream cancels the sequence.Solo<T>doOnComplete(Action onComplete)Executes a callback when the upstream completes normally.Solo<T>doOnError(Consumer<? super java.lang.Throwable> onError)Executes a callback when the upstream signals an error.Solo<T>doOnNext(Consumer<? super T> onNext)Executes a callback before the value is emitted to downstream.Solo<T>doOnRequest(LongConsumer onRequest)Executes the callback when the downstream requests from this Solo.Solo<T>doOnSubscribe(Consumer<? super Subscription> onSubscribe)Executes a callback when the upstream calls onSubscribe.static <T> Solo<T>error(Supplier<? extends java.lang.Throwable> errorSupplier)Returns a Solo that signals the error returned from the errorSupplier to each individual Subscriber.static <T> Solo<T>error(java.lang.Throwable error)Returns a Solo that signals the given error to Subscribers.Perhaps<T>filter(Predicate<? super T> predicate)Applies a predicate to the value and emits it if the predicate returns true, completes otherwise.<R> Solo<R>flatMap(Function<? super T,? extends Solo<? extends R>> mapper)Maps the success value of this Solo into another Solo and emits its signals.<R> Solo<R>flatMap(Function<? super T,? extends Solo<? extends R>> onSuccessMapper, Function<? super java.lang.Throwable,? extends Solo<? extends R>> onErrorMapper)Maps the success value or the failure of this Solo into another Solo and emits its signal.<R> Flowable<R>flatMapPublisher(Function<? super T,? extends Publisher<? extends R>> mapper)Maps the success value of this Solo into a Publisher and emits its signals.static <T> Solo<T>fromCallable(java.util.concurrent.Callable<T> callable)Returns a Solo that calls the callable and emits its value or error.static <T> Solo<T>fromFuture(java.util.concurrent.Future<? extends T> future)When subscribed, the future is awaited blockingly and indefinitely for its result value; null result will yield a NoSuchElementException.static <T> Solo<T>fromFuture(java.util.concurrent.Future<? extends T> future, long timeout, java.util.concurrent.TimeUnit unit)When subscribed, the future is awaited blockingly for a given amount of time for its result value; null result will yield a NoSuchElementException and a timeout will yield a TimeoutException.static <T> Solo<T>fromPublisher(Publisher<T> source)Wraps a Publisher into a Solo and signals its only value, NoSuchElementException if empty or IndexOutOfBoundsException if it has more than one element.static <T> Solo<T>fromSingle(SingleSource<T> source)Wraps a Single into a Solo and signals its events.static <T> Function<Solo<T>,Solo<T>>getOnAssemblyHandler()Returns the current onAssembly handler.Solo<T>hide()Hides the identity of this Solo, including its Subscription and allows preventing fusion and other optimizations for diagnostic purposes.NonoignoreElement()Ignore the solo value of this Solo and only signal the terminal events.static <T> Solo<T>just(T item)Returns a Solo that signals the given item and completes.<R> Solo<R>lift(Function<Subscriber<? super R>,Subscriber<? super T>> onLift)Map the downstream Subscriber into an upstream Subscriber.<R> Solo<R>map(Function<? super T,? extends R> mapper)Maps the value of this Solo into another value via function.Solo<T>mapError(Function<? super java.lang.Throwable,? extends java.lang.Throwable> errorMapper)Maps the Throwable error of this Solo into another Throwable error type.static <T> Flowable<T>merge(java.lang.Iterable<? extends Solo<? extends T>> sources)Merge the values in arbitrary order from a sequence of Solo sources.static <T> Flowable<T>merge(java.lang.Iterable<? extends Solo<? extends T>> sources, int maxConcurrency)Merge the values in arbitrary order from a sequence of Solo sources.static <T> Flowable<T>merge(Publisher<? extends Solo<? extends T>> sources)Merge the values in arbitrary order from a sequence of Solo sources.static <T> Flowable<T>merge(Publisher<? extends Solo<? extends T>> sources, int maxConcurrency)Merge the values in arbitrary order from a sequence of Solo sources.static <T> Flowable<T>mergeArray(int maxConcurrency, Solo<? extends T>... sources)Merge the values in arbitrary order from a sequence of Solo sources.static <T> Flowable<T>mergeArray(Solo<? extends T>... sources)Merge the values in arbitrary order from a sequence of Solo sources.static <T> Flowable<T>mergeArrayDelayError(int maxConcurrency, Solo<? extends T>... sources)Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>mergeArrayDelayError(Solo<? extends T>... sources)Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>mergeDelayError(java.lang.Iterable<? extends Solo<? extends T>> sources)Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>mergeDelayError(java.lang.Iterable<? extends Solo<? extends T>> sources, int maxConcurrency)Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>mergeDelayError(Publisher<? extends Solo<? extends T>> sources)Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.static <T> Flowable<T>mergeDelayError(Publisher<? extends Solo<? extends T>> sources, int maxConcurrency)Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.Flowable<T>mergeWith(Solo<T> other)Merges the values of this Solo and the other Solo into a Flowable sequence.static <T> Solo<T>never()Returns a Solo that never signals an item or terminal event.Solo<T>observeOn(Scheduler scheduler)Returns a Solo that delivers the onNext, onError and onComplete signals from this Solo on the specified scheduler.protected static <T> Solo<T>onAssembly(Solo<T> source)Solo<T>onErrorResumeNext(Function<? super java.lang.Throwable,? extends Solo<T>> errorHandler)If the upstream signals an error, call a function and subscribe to the Solo it returns.Solo<T>onErrorResumeWith(Solo<T> next)If the upstream signals an error, switch over to the next Solo and emits its signal instead.Solo<T>onErrorReturnItem(T item)If the upstream signals an error, signal an item instead.Flowable<T>repeat()Repeats this Solo indefinitely.Flowable<T>repeat(long times)Repeats this Solo at most the given number of times.Flowable<T>repeat(BooleanSupplier stop)Repeats this Solo until the given boolean supplier returns true when an repeat iteration of this Solo completes.Flowable<T>repeatWhen(Function<? super Flowable<java.lang.Object>,? extends Publisher<?>> handler)Repeats this Solo when the Publisher returned by the handler function emits an item or terminates if this Publisher terminates.Solo<T>retry()Retry this Solo indefinitely if it fails.Solo<T>retry(long times)Retry this Solo at most the given number of times if it fails.Solo<T>retry(Predicate<? super java.lang.Throwable> predicate)Retry this Solo if the predicate returns true for the latest failure Throwable.Solo<T>retryWhen(Function<? super Flowable<java.lang.Throwable>,? extends Publisher<?>> handler)Retry this solo if the Publisher returned by the handler signals an item in response to the failure Throwable.static <T> voidsetOnAssemblyHandler(Function<Solo<T>,Solo<T>> handler)Set the onAssembly handler.Disposablesubscribe()Subscribe to this Solo and ignore any signal it produces.Disposablesubscribe(Consumer<? super T> onNext)Subscribes to this Solo and calls the onNext if this Solo succeeds.Disposablesubscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError)Subscribes to this Solo and calls the appropriate callback for the resulting signal.Disposablesubscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete)Subscribes to this Solo and calls the appropriate callback for the resulting signal.voidsubscribe(Subscriber<? super T> s)protected abstract voidsubscribeActual(Subscriber<? super T> s)Implement this method to react to a Subscriber subscribing to this Solo.Solo<T>subscribeOn(Scheduler scheduler)Returns a Solo that subscribes to this Solo on the specified scheduler and makes sure downstream requests are forwarded there as well.<E extends Subscriber<? super T>>
EsubscribeWith(E s)Subscribe with a Subscriber (subclass) and return it as is.Solo<T>takeUntil(Publisher<?> other)Signal a NoSuchElementException if the other signals before this Solo signals.TestSubscriber<T>test()Creates a TestSubscriber and subscribes it to this Solo.TestSubscriber<T>test(boolean cancel)Creates a TestSubscriber, optionally cancels it, and subscribes it to this Solo.TestSubscriber<T>test(long initialRequest)Creates a TestSubscriber with the given initial request and subscribes it to this Solo.TestSubscriber<T>test(long initialRequest, boolean cancel)Creates a TestSubscriber with the given initial request, optionally cancels it, and subscribes it to this Solo.Solo<T>timeout(long timeout, java.util.concurrent.TimeUnit unit)Signal a TimeoutException if there is no item from this Solo within the given timeout time.Solo<T>timeout(long timeout, java.util.concurrent.TimeUnit unit, Solo<T> fallback)Fall back to another Solo if this Solo doesn't signal within the given time period.Solo<T>timeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler)Signal a TimeoutException if there is no item from this Solo within the given timeout time, running on the specified scheduler.Solo<T>timeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler, Solo<T> fallback)Fall back to another Solo if this Solo doesn't signal within the given time period, waiting on the specified scheduler.Solo<T>timeout(Publisher<?> other)Signal a TimeoutException if the other Publisher signals or completes before this Solo signals a value.Solo<T>timeout(Publisher<?> other, Solo<T> fallback)Fall back to another Solo if the other Publisher signals or completes before this Solo signals a value.static Solo<java.lang.Long>timer(long delay, java.util.concurrent.TimeUnit unit)Signals a 0L after the specified amount of time has passed since subscription.static Solo<java.lang.Long>timer(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)Signals a 0L after the specified amount of time has passed since subscription on the specified scheduler.<R> Rto(Function<? super Solo<T>,R> converter)Applies the function, fluently to this Solo and returns the value it returns.Flowable<T>toFlowable()Converts this Solo into a Flowable.java.util.concurrent.Future<T>toFuture()Converts this Solo into a Future and signals its single value.Observable<T>toObservable()Converts this Solo into an Observable.Single<T>toSingle()Converts this Soli into a Single.Solo<T>unsubscribeOn(Scheduler scheduler)Returns a Solo which when cancelled, cancels this Solo on the specified scheduler.static <T,R>
Solo<T>using(Supplier<R> resourceSupplier, Function<? super R,? extends Solo<T>> sourceSupplier, Consumer<? super R> disposer)Generate a resource and a Solo based on that resource and then dispose that resource eagerly when the Solo terminates or the downstream cancels the sequence.static <T,R>
Solo<T>using(Supplier<R> resourceSupplier, Function<? super R,? extends Solo<T>> sourceSupplier, Consumer<? super R> disposer, boolean eager)Generate a resource and a Solo based on that resource and then dispose that resource eagerly when the Solo terminates or the downstream cancels the sequence.static <T,R>
Solo<R>zip(java.lang.Iterable<? extends Solo<? extends T>> sources, Function<? super java.lang.Object[],? extends R> zipper)Combines the solo values of all the sources via a zipper function into a single resulting value.static <T,R>
Solo<R>zipArray(Function<? super java.lang.Object[],? extends R> zipper, Solo<? extends T>... sources)Combines the solo values of all the sources via a zipper function into a single resulting value.<U,R>
Solo<R>zipWith(Solo<U> other, BiFunction<? super T,? super U,? extends R> zipper)Combines the values of this and the other Solo via a BiFunction.
-
-
-
Method Detail
-
getOnAssemblyHandler
public static <T> Function<Solo<T>,Solo<T>> getOnAssemblyHandler()
Returns the current onAssembly handler.- Type Parameters:
T- the target value type- Returns:
- the current handler, maybe null
-
setOnAssemblyHandler
public static <T> void setOnAssemblyHandler(Function<Solo<T>,Solo<T>> handler)
Set the onAssembly handler.- Type Parameters:
T- the target value type- Parameters:
handler- the handler, null clears the handler
-
create
public static <T> Solo<T> create(SingleOnSubscribe<T> onCreate)
Create a Solo that for each incoming Subscriber calls a callback to emit a sync or async events in a thread-safe, backpressure-aware and cancellation-safe manner.- Type Parameters:
T- the value type emitted- Parameters:
onCreate- the callback called for each individual subscriber with an abstraction of the incoming Subscriber.- Returns:
- th new Solo instance
-
just
public static <T> Solo<T> just(T item)
Returns a Solo that signals the given item and completes.- Type Parameters:
T- the value type- Parameters:
item- the item, not null- Returns:
- the new Solo instance
-
error
public static <T> Solo<T> error(java.lang.Throwable error)
Returns a Solo that signals the given error to Subscribers.- Type Parameters:
T- the value type- Parameters:
error- the error to signal, not null- Returns:
- the new Solo instance
-
error
public static <T> Solo<T> error(Supplier<? extends java.lang.Throwable> errorSupplier)
Returns a Solo that signals the error returned from the errorSupplier to each individual Subscriber.- Type Parameters:
T- the value type- Parameters:
errorSupplier- the supplier called for each Subscriber to return a Throwable to be signalled- Returns:
- the new Solo instance
-
fromCallable
public static <T> Solo<T> fromCallable(java.util.concurrent.Callable<T> callable)
Returns a Solo that calls the callable and emits its value or error.- Type Parameters:
T- the value type- Parameters:
callable- the callable to call- Returns:
- the new Solo instance
-
never
public static <T> Solo<T> never()
Returns a Solo that never signals an item or terminal event.- Type Parameters:
T- the value type- Returns:
- the new Solo instance
-
defer
public static <T> Solo<T> defer(Supplier<? extends Solo<T>> supplier)
Defers the creation of the actual Solo to the time when a Subscriber subscribes to the returned Solo.- Type Parameters:
T- the value type- Parameters:
supplier- the supplier of the actual Solo- Returns:
- the new Solo instance
-
fromPublisher
public static <T> Solo<T> fromPublisher(Publisher<T> source)
Wraps a Publisher into a Solo and signals its only value, NoSuchElementException if empty or IndexOutOfBoundsException if it has more than one element.- Type Parameters:
T- the value type- Parameters:
source- the source Publisher- Returns:
- the new Solo instance
-
fromSingle
public static <T> Solo<T> fromSingle(SingleSource<T> source)
Wraps a Single into a Solo and signals its events.- Type Parameters:
T- the value type- Parameters:
source- the source Single- Returns:
- the new Solo instance
-
fromFuture
public static <T> Solo<T> fromFuture(java.util.concurrent.Future<? extends T> future)
When subscribed, the future is awaited blockingly and indefinitely for its result value; null result will yield a NoSuchElementException.- Type Parameters:
T- the value type- Parameters:
future- the future to await- Returns:
- the new Solo instance
- Since:
- 0.14.0
-
fromFuture
public static <T> Solo<T> fromFuture(java.util.concurrent.Future<? extends T> future, long timeout, java.util.concurrent.TimeUnit unit)
When subscribed, the future is awaited blockingly for a given amount of time for its result value; null result will yield a NoSuchElementException and a timeout will yield a TimeoutException.- Type Parameters:
T- the value type- Parameters:
future- the future to awaittimeout- the timeout valueunit- the time unit- Returns:
- the new Solo instance
- Since:
- 0.14.0
-
amb
public static <T> Solo<T> amb(java.lang.Iterable<? extends Solo<? extends T>> sources)
Emit the events of the Solo that reacts first.- Type Parameters:
T- the common value type- Parameters:
sources- the Iterable sequence of Solo sources- Returns:
- the new Solo instance
-
ambArray
@SafeVarargs public static <T> Solo<T> ambArray(Solo<? extends T>... sources)
Emit the events of the Solo that reacts first.- Type Parameters:
T- the common value type- Parameters:
sources- the array of Solo sources- Returns:
- the new Solo instance
-
concat
public static <T> Flowable<T> concat(java.lang.Iterable<? extends Solo<? extends T>> sources)
Concatenate the values in order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
concat
public static <T> Flowable<T> concat(Publisher<? extends Solo<? extends T>> sources)
Concatenate the values in order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
concat
public static <T> Flowable<T> concat(Publisher<? extends Solo<? extends T>> sources, int prefetch)
Concatenate the values in order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesprefetch- the number of sources to prefetch from upstream- Returns:
- the new Flowable instance
-
concatArray
@SafeVarargs public static <T> Flowable<T> concatArray(Solo<? extends T>... sources)
Concatenate the values in order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
concatDelayError
public static <T> Flowable<T> concatDelayError(java.lang.Iterable<? extends Solo<? extends T>> sources)
Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
concatDelayError
public static <T> Flowable<T> concatDelayError(Publisher<? extends Solo<? extends T>> sources)
Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
concatDelayError
public static <T> Flowable<T> concatDelayError(Publisher<? extends Solo<? extends T>> sources, int prefetch)
Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesprefetch- the number of sources to prefetch from upstream- Returns:
- the new Flowable instance
-
concatDelayError
public static <T> Flowable<T> concatDelayError(Publisher<? extends Solo<? extends T>> sources, int prefetch, boolean tillTheEnd)
Concatenate the values in order from a sequence of Solo sources, delaying errors till a source terminates or the whole sequence terminates.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesprefetch- the number of sources to prefetch from upstreamtillTheEnd- if true, errors are delayed to the very end; if false, an error will be signalled at the end of one source- Returns:
- the new Flowable instance
-
concatArrayDelayError
@SafeVarargs public static <T> Flowable<T> concatArrayDelayError(Solo<? extends T>... sources)
Concatenate the values in order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
merge
public static <T> Flowable<T> merge(java.lang.Iterable<? extends Solo<? extends T>> sources)
Merge the values in arbitrary order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
merge
public static <T> Flowable<T> merge(java.lang.Iterable<? extends Solo<? extends T>> sources, int maxConcurrency)
Merge the values in arbitrary order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesmaxConcurrency- the maximum number of active subscriptions- Returns:
- the new Flowable instance
-
merge
public static <T> Flowable<T> merge(Publisher<? extends Solo<? extends T>> sources)
Merge the values in arbitrary order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
merge
public static <T> Flowable<T> merge(Publisher<? extends Solo<? extends T>> sources, int maxConcurrency)
Merge the values in arbitrary order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesmaxConcurrency- the maximum number of active subscriptions- Returns:
- the new Flowable instance
-
mergeArray
@SafeVarargs public static <T> Flowable<T> mergeArray(Solo<? extends T>... sources)
Merge the values in arbitrary order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
mergeArray
@SafeVarargs public static <T> Flowable<T> mergeArray(int maxConcurrency, Solo<? extends T>... sources)
Merge the values in arbitrary order from a sequence of Solo sources.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesmaxConcurrency- the maximum number of active subscriptions- Returns:
- the new Flowable instance
-
mergeDelayError
public static <T> Flowable<T> mergeDelayError(java.lang.Iterable<? extends Solo<? extends T>> sources)
Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
mergeDelayError
public static <T> Flowable<T> mergeDelayError(java.lang.Iterable<? extends Solo<? extends T>> sources, int maxConcurrency)
Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesmaxConcurrency- the maximum number of active subscriptions- Returns:
- the new Flowable instance
-
mergeDelayError
public static <T> Flowable<T> mergeDelayError(Publisher<? extends Solo<? extends T>> sources)
Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
mergeDelayError
public static <T> Flowable<T> mergeDelayError(Publisher<? extends Solo<? extends T>> sources, int maxConcurrency)
Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesmaxConcurrency- the maximum number of active subscriptions- Returns:
- the new Flowable instance
-
mergeArrayDelayError
@SafeVarargs public static <T> Flowable<T> mergeArrayDelayError(Solo<? extends T>... sources)
Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sources- Returns:
- the new Flowable instance
-
mergeArrayDelayError
@SafeVarargs public static <T> Flowable<T> mergeArrayDelayError(int maxConcurrency, Solo<? extends T>... sources)
Merge the values in arbitrary order from a sequence of Solo sources, delaying errors till all sources terminate.- Type Parameters:
T- the common base value type- Parameters:
sources- the sequence of sourcesmaxConcurrency- the maximum number of active subscriptions- Returns:
- the new Flowable instance
-
timer
public static Solo<java.lang.Long> timer(long delay, java.util.concurrent.TimeUnit unit)
Signals a 0L after the specified amount of time has passed since subscription.- Parameters:
delay- the delay timeunit- the time unit- Returns:
- the new Solo instance
-
timer
public static Solo<java.lang.Long> timer(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Signals a 0L after the specified amount of time has passed since subscription on the specified scheduler.- Parameters:
delay- the delay timeunit- the time unitscheduler- the scheduler to wait on- Returns:
- the new Solo instance
-
using
public static <T,R> Solo<T> using(Supplier<R> resourceSupplier, Function<? super R,? extends Solo<T>> sourceSupplier, Consumer<? super R> disposer)
Generate a resource and a Solo based on that resource and then dispose that resource eagerly when the Solo terminates or the downstream cancels the sequence.- Type Parameters:
T- the value typeR- the resource type- Parameters:
resourceSupplier- the callback to get a resource for each subscribersourceSupplier- the function that returns a Solo for the generated resourcedisposer- the consumer of the resource once the upstream terminates or the downstream cancels- Returns:
- the new Solo instance
-
using
public static <T,R> Solo<T> using(Supplier<R> resourceSupplier, Function<? super R,? extends Solo<T>> sourceSupplier, Consumer<? super R> disposer, boolean eager)
Generate a resource and a Solo based on that resource and then dispose that resource eagerly when the Solo terminates or the downstream cancels the sequence.- Type Parameters:
T- the value typeR- the resource type- Parameters:
resourceSupplier- the callback to get a resource for each subscribersourceSupplier- the function that returns a Solo for the generated resourcedisposer- the consumer of the resource once the upstream terminates or the downstream cancelseager- if true, the resource is disposed before the terminal event is emitted if false, the resource is disposed after the terminal event has been emitted- Returns:
- the new Solo instance
-
zip
public static <T,R> Solo<R> zip(java.lang.Iterable<? extends Solo<? extends T>> sources, Function<? super java.lang.Object[],? extends R> zipper)
Combines the solo values of all the sources via a zipper function into a single resulting value.- Type Parameters:
T- the common input base typeR- the result type- Parameters:
sources- the sequence of Solo sourceszipper- the function takin in an array of values and returns a solo value- Returns:
- the new Solo instance
-
zipArray
@SafeVarargs public static <T,R> Solo<R> zipArray(Function<? super java.lang.Object[],? extends R> zipper, Solo<? extends T>... sources)
Combines the solo values of all the sources via a zipper function into a single resulting value.- Type Parameters:
T- the common input base typeR- the result type- Parameters:
sources- the sequence of Solo sourceszipper- the function takin in an array of values and returns a solo value- Returns:
- the new Solo instance
-
ambWith
public final Solo<T> ambWith(Solo<? extends T> other)
Signal the events of this or the other Solo whichever signals first.- Parameters:
other- the other Solo- Returns:
- the new Solo instance
-
andThen
public final Solo<T> andThen(Nono other)
Run the given Nono after this Solo completes successfully and emit that original success value only if the Nono completes normally.- Parameters:
other- the other Nono to execute- Returns:
- the new Solo instance
-
andThen
public final Flowable<T> andThen(Publisher<? extends T> other)
Emits the success value of this Solo and then continues with the events of the other Publisher.- Parameters:
other- the other Publisher instance- Returns:
- the new Flowable instance
-
concatWith
public final Flowable<T> concatWith(Solo<T> other)
Emits the success value of this Solo followed by the event of the other Solo.- Parameters:
other- the other Solo instance- Returns:
- the new Flowable instance
-
mergeWith
public final Flowable<T> mergeWith(Solo<T> other)
Merges the values of this Solo and the other Solo into a Flowable sequence.- Parameters:
other- the other Solo instance- Returns:
- the new Flowable instance
-
zipWith
public final <U,R> Solo<R> zipWith(Solo<U> other, BiFunction<? super T,? super U,? extends R> zipper)
Combines the values of this and the other Solo via a BiFunction.- Type Parameters:
U- the other value typeR- the result value type- Parameters:
other- the other Solo sourcezipper- the bi-function taking the success value from this and the other Solo and returns a solo value to be emitted.- Returns:
- the new Solo instance
-
map
public final <R> Solo<R> map(Function<? super T,? extends R> mapper)
Maps the value of this Solo into another value via function.- Type Parameters:
R- the output value type- Parameters:
mapper- the function that receives the success value of this Solo and returns a replacement value.- Returns:
- the new Solo instance
-
mapError
public final Solo<T> mapError(Function<? super java.lang.Throwable,? extends java.lang.Throwable> errorMapper)
Maps the Throwable error of this Solo into another Throwable error type.- Parameters:
errorMapper- the function that receives the Throwable and should return a Throwable to be emitted.- Returns:
- the new Solo instance
-
filter
public final Perhaps<T> filter(Predicate<? super T> predicate)
Applies a predicate to the value and emits it if the predicate returns true, completes otherwise.- Parameters:
predicate- the predicate called with the solo value- Returns:
- the new Perhaps instance
-
timeout
public final Solo<T> timeout(long timeout, java.util.concurrent.TimeUnit unit)
Signal a TimeoutException if there is no item from this Solo within the given timeout time.- Parameters:
timeout- the timeout valueunit- the time unit- Returns:
- the new Solo instance
-
timeout
public final Solo<T> timeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Signal a TimeoutException if there is no item from this Solo within the given timeout time, running on the specified scheduler.- Parameters:
timeout- the timeout valueunit- the time unitscheduler- the scheduler to wait on- Returns:
- the new Solo instance
-
timeout
public final Solo<T> timeout(long timeout, java.util.concurrent.TimeUnit unit, Solo<T> fallback)
Fall back to another Solo if this Solo doesn't signal within the given time period.- Parameters:
timeout- the timeout valueunit- the time unitfallback- the other Solo to subscribe to- Returns:
- the new Solo instance
-
timeout
public final Solo<T> timeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler, Solo<T> fallback)
Fall back to another Solo if this Solo doesn't signal within the given time period, waiting on the specified scheduler.- Parameters:
timeout- the timeout valueunit- the time unitscheduler- the scheduler to wait onfallback- the fallback Solo to subscribe to- Returns:
- the new Solo instance
-
timeout
public final Solo<T> timeout(Publisher<?> other)
Signal a TimeoutException if the other Publisher signals or completes before this Solo signals a value.- Parameters:
other- the other Publisher triggers the TimeoutException when it signals its first item or completes.- Returns:
- the new Solo instance
-
timeout
public final Solo<T> timeout(Publisher<?> other, Solo<T> fallback)
Fall back to another Solo if the other Publisher signals or completes before this Solo signals a value.- Parameters:
other- the other Publisher triggers the TimeoutException when it signals its first item or completes.fallback- the fallback Solo to subscribe to in case of a timeout- Returns:
- the new Solo instance
-
onErrorReturnItem
public final Solo<T> onErrorReturnItem(T item)
If the upstream signals an error, signal an item instead.- Parameters:
item- the item to signal if the upstream fails- Returns:
- the new Solo instance
-
onErrorResumeWith
public final Solo<T> onErrorResumeWith(Solo<T> next)
If the upstream signals an error, switch over to the next Solo and emits its signal instead.- Parameters:
next- the other Solo to switch to in case of an upstream error- Returns:
- the new Solo instance
-
onErrorResumeNext
public final Solo<T> onErrorResumeNext(Function<? super java.lang.Throwable,? extends Solo<T>> errorHandler)
If the upstream signals an error, call a function and subscribe to the Solo it returns.- Parameters:
errorHandler- the function receiving the upstream error and returns a Solo to resume with.- Returns:
- the new Solo instance
-
flatMap
public final <R> Solo<R> flatMap(Function<? super T,? extends Solo<? extends R>> mapper)
Maps the success value of this Solo into another Solo and emits its signals.- Type Parameters:
R- the result type- Parameters:
mapper- the function that receives the success value and returns another Solo to subscribe to- Returns:
- the new Solo instance
-
flatMap
public final <R> Solo<R> flatMap(Function<? super T,? extends Solo<? extends R>> onSuccessMapper, Function<? super java.lang.Throwable,? extends Solo<? extends R>> onErrorMapper)
Maps the success value or the failure of this Solo into another Solo and emits its signal.- Type Parameters:
R- the result type- Parameters:
onSuccessMapper- the function that receives the success value and return another Solo to subscribe toonErrorMapper- the function that receives the Throwable error and return another Solo to subscribe to- Returns:
- th new Solo instance
-
flatMapPublisher
public final <R> Flowable<R> flatMapPublisher(Function<? super T,? extends Publisher<? extends R>> mapper)
Maps the success value of this Solo into a Publisher and emits its signals.- Type Parameters:
R- the result type- Parameters:
mapper- the function that takes the success value of this Solo and returns a Publisher- Returns:
- the new Flowable instance
-
takeUntil
public final Solo<T> takeUntil(Publisher<?> other)
Signal a NoSuchElementException if the other signals before this Solo signals.- Parameters:
other- the other Publisher- Returns:
- the new Solo instance
-
delay
public final Solo<T> delay(long delay, java.util.concurrent.TimeUnit unit)
Delay the emission of the signal of this Solo with the specified time amount.- Parameters:
delay- the delay timeunit- the delay time unit- Returns:
- the new Solo instance
-
delay
public final Solo<T> delay(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Delay the emission of the signal of this Solo with the specified time amount on the specified scheduler.- Parameters:
delay- the delay timeunit- the delay time unitscheduler- the scheduler to wait on- Returns:
- the new Solo instance
-
delay
public final Solo<T> delay(Publisher<?> other)
Delay the emission of the signal until the other Publisher signals an item or completes.- Parameters:
other- the other Publisher that has to signal to emit the origina signal from this Solo- Returns:
- the new Solo instance
-
delaySubscription
public final Solo<T> delaySubscription(Publisher<?> other)
Delay the subscription to this Solo until the other Publisher signals a value or completes.- Parameters:
other- the other Publisher to trigger the actual subscription- Returns:
- the new Solo type
-
delaySubscription
public final Solo<T> delaySubscription(long delay, java.util.concurrent.TimeUnit unit)
Delay the subscription to this Solo until the specified delay elapses.- Parameters:
delay- the delay timeunit- the delay unit- Returns:
- the new Solo type
-
delaySubscription
public final Solo<T> delaySubscription(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Delay the subscription to this Solo until the specified delay elapses.- Parameters:
delay- the delay timeunit- the delay unitscheduler- the scheduler to wait on- Returns:
- the new Solo type
-
toFlowable
public final Flowable<T> toFlowable()
Converts this Solo into a Flowable.- Returns:
- the new Flowable instance
-
toObservable
public final Observable<T> toObservable()
Converts this Solo into an Observable.- Returns:
- the new Observable instance
-
toSingle
public final Single<T> toSingle()
Converts this Soli into a Single.- Returns:
- the new Single instance
-
doOnSubscribe
public final Solo<T> doOnSubscribe(Consumer<? super Subscription> onSubscribe)
Executes a callback when the upstream calls onSubscribe.- Parameters:
onSubscribe- the consumer called with the upstream Subscription- Returns:
- the new Solo instance
-
doOnRequest
public final Solo<T> doOnRequest(LongConsumer onRequest)
Executes the callback when the downstream requests from this Solo.- Parameters:
onRequest- the callback called with the request amount- Returns:
- the new Solo instance
-
doOnCancel
public final Solo<T> doOnCancel(Action onCancel)
Executes the callback if the downstream cancels the sequence.- Parameters:
onCancel- the action to call- Returns:
- the new Solo instance
-
doOnNext
public final Solo<T> doOnNext(Consumer<? super T> onNext)
Executes a callback before the value is emitted to downstream.- Parameters:
onNext- the consumer called with the current value before it is is emitted to downstream.- Returns:
- the new Solo instance
-
doAfterNext
public final Solo<T> doAfterNext(Consumer<? super T> onAfterNext)
Executes a callback after the value is emitted to downstream.- Parameters:
onAfterNext- the consumer called with the current value after it is is emitted to downstream.- Returns:
- the new Solo instance
-
doOnError
public final Solo<T> doOnError(Consumer<? super java.lang.Throwable> onError)
Executes a callback when the upstream signals an error.- Parameters:
onError- the consumer called before the error is emitted to the downstream- Returns:
- the new Solo instance
-
doOnComplete
public final Solo<T> doOnComplete(Action onComplete)
Executes a callback when the upstream completes normally.- Parameters:
onComplete- the consumer called before the completion event is emitted to the downstream.- Returns:
- the new Solo instance
-
doAfterTerminate
public final Solo<T> doAfterTerminate(Action onAfterTerminate)
Executes the callback after this Solo terminates and the downstream is notified.- Parameters:
onAfterTerminate- the callback to call after the downstream is notified- Returns:
- the new Solo instance
-
doFinally
public final Solo<T> doFinally(Action onFinally)
Executes the callback exactly if the upstream terminates or the downstream cancels the sequence.- Parameters:
onFinally- the action to call- Returns:
- the new Solo instance
-
ignoreElement
public final Nono ignoreElement()
Ignore the solo value of this Solo and only signal the terminal events.- Returns:
- the new Nono instance
-
hide
public final Solo<T> hide()
Hides the identity of this Solo, including its Subscription and allows preventing fusion and other optimizations for diagnostic purposes.- Returns:
- the new Solo instance
-
to
public final <R> R to(Function<? super Solo<T>,R> converter)
Applies the function, fluently to this Solo and returns the value it returns.- Type Parameters:
R- the result type- Parameters:
converter- the function receiving this Solo and returns a value to be returned- Returns:
- the value returned by the function
-
compose
public final <R> Solo<R> compose(Function<? super Solo<T>,? extends Solo<R>> composer)
Applies a function to this Solo and returns the Solo it returned.- Type Parameters:
R- the result type- Parameters:
composer- the function that receives this Solo and should return a Solo- Returns:
- the new Solo instance
-
lift
public final <R> Solo<R> lift(Function<Subscriber<? super R>,Subscriber<? super T>> onLift)
Map the downstream Subscriber into an upstream Subscriber.- Type Parameters:
R- the downstream value type- Parameters:
onLift- the function called with the downstream's Subscriber and should return a Subscriber to be subscribed to this Solo.- Returns:
- the new Solo type
-
repeat
public final Flowable<T> repeat()
Repeats this Solo indefinitely.- Returns:
- the new Flowable instance
-
repeat
public final Flowable<T> repeat(long times)
Repeats this Solo at most the given number of times.- Parameters:
times- the number of times to repeat- Returns:
- the new Flowable instance
-
repeat
public final Flowable<T> repeat(BooleanSupplier stop)
Repeats this Solo until the given boolean supplier returns true when an repeat iteration of this Solo completes.- Parameters:
stop- the supplier of a boolean value that should return true to stop repeating.- Returns:
- the new Flowable instance
-
repeatWhen
public final Flowable<T> repeatWhen(Function<? super Flowable<java.lang.Object>,? extends Publisher<?>> handler)
Repeats this Solo when the Publisher returned by the handler function emits an item or terminates if this Publisher terminates.- Parameters:
handler- the function that receives Flowable that emits an item when this Solo completes and returns a Publisher that should emit an item to trigger a repeat or terminate to trigger a termination.- Returns:
- the new Flowable instance
-
retry
public final Solo<T> retry()
Retry this Solo indefinitely if it fails.- Returns:
- the new Solo instance
-
retry
public final Solo<T> retry(long times)
Retry this Solo at most the given number of times if it fails.- Parameters:
times- the number of times, Long.MAX_VALUE means indefinitely- Returns:
- the new Solo instance
-
retry
public final Solo<T> retry(Predicate<? super java.lang.Throwable> predicate)
Retry this Solo if the predicate returns true for the latest failure Throwable.- Parameters:
predicate- the predicate receiving the latest Throwable and if returns true, the Solo is retried.- Returns:
- the new Solo instance
-
retryWhen
public final Solo<T> retryWhen(Function<? super Flowable<java.lang.Throwable>,? extends Publisher<?>> handler)
Retry this solo if the Publisher returned by the handler signals an item in response to the failure Throwable.- Parameters:
handler- the function that receives a Flowable that signals the failure Throwable of this Solo and returns a Publisher which triggers a retry or termination.- Returns:
- the new Solo instance
-
subscribeOn
public final Solo<T> subscribeOn(Scheduler scheduler)
Returns a Solo that subscribes to this Solo on the specified scheduler and makes sure downstream requests are forwarded there as well.- Parameters:
scheduler- the scheduler to subscribe on- Returns:
- the new Solo instance
-
observeOn
public final Solo<T> observeOn(Scheduler scheduler)
Returns a Solo that delivers the onNext, onError and onComplete signals from this Solo on the specified scheduler.- Parameters:
scheduler- the scheduler to emit the events on- Returns:
- the new Solo instance
-
unsubscribeOn
public final Solo<T> unsubscribeOn(Scheduler scheduler)
Returns a Solo which when cancelled, cancels this Solo on the specified scheduler.- Parameters:
scheduler- the scheduler to cancel this Solo- Returns:
- the new Solo instance
-
cache
public final Solo<T> cache()
Caches the value or error event of the upstream Solo and relays/replays it to Subscribers.- Returns:
- the new Solo instance
- Since:
- 0.14.1
-
subscribe
public final void subscribe(Subscriber<? super T> s)
-
subscribeActual
protected abstract void subscribeActual(Subscriber<? super T> s)
Implement this method to react to a Subscriber subscribing to this Solo.- Parameters:
s- the downstream Subscriber, never null
-
subscribeWith
public final <E extends Subscriber<? super T>> E subscribeWith(E s)
Subscribe with a Subscriber (subclass) and return it as is.- Type Parameters:
E- the Subscriber subclass type- Parameters:
s- the soubscriber, not null- Returns:
- the
sas is
-
subscribe
public final Disposable subscribe()
Subscribe to this Solo and ignore any signal it produces.- Returns:
- the Disposable that allows cancelling the subscription
-
subscribe
public final Disposable subscribe(Consumer<? super T> onNext)
Subscribes to this Solo and calls the onNext if this Solo succeeds.- Parameters:
onNext- called when this Solo succeeds- Returns:
- the Disposable that allows cancelling the subscription
-
subscribe
public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError)
Subscribes to this Solo and calls the appropriate callback for the resulting signal.- Parameters:
onNext- called when this Solo succeedsonError- called when this Solo fails- Returns:
- the Disposable that allows cancelling the subscription
-
subscribe
public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete)
Subscribes to this Solo and calls the appropriate callback for the resulting signal.- Parameters:
onNext- called when this Solo succeedsonError- called when this Solo failsonComplete- called when this Solo succeeds after the call to onNext- Returns:
- the Disposable that allows cancelling the subscription
-
blockingSubscribe
public final void blockingSubscribe()
Blocks until this Solo terminates and ignores the signals it produced.
-
blockingSubscribe
public final void blockingSubscribe(Consumer<? super T> onNext)
Blocks until this Solo terminates and calls the onNext with the success value.- Parameters:
onNext- the callback to call when this Solo completes with a success value
-
blockingSubscribe
public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError)
Blocks until this solo terminates and calls the onNext with the success value or calls the onError with the error Throwable.- Parameters:
onNext- the callback to call when this Solo completes with a success valueonError- the callback to call when this Solo fails with an error
-
blockingSubscribe
public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete)
Blocks until this Solo produces its terminal signal and calls the appropriate callback(s) based on the signal type.- Parameters:
onNext- called when the Solo succeedsonError- called when the Solo failsonComplete- called when the Solo succeeds after the call to onNext.
-
blockingGet
public final T blockingGet()
Blockingly awaits indefinitely the success value of this Solo or rethrows its error (wrapped into a RuntimeException if necessary).- Returns:
- the success value of this Solo
-
blockingGet
public final T blockingGet(long timeout, java.util.concurrent.TimeUnit unit)
Blockingly awaits at most the given timeout for the success value of this Solo or rethrows its error (wrapped into a RuntimeException if necessary).- Parameters:
timeout- the time to wait for a success valueunit- the time unit of the timeout- Returns:
- the success value of this Solo
-
test
public final TestSubscriber<T> test()
Creates a TestSubscriber and subscribes it to this Solo.- Returns:
- the new TestSubscriber instance
-
test
public final TestSubscriber<T> test(boolean cancel)
Creates a TestSubscriber, optionally cancels it, and subscribes it to this Solo.- Parameters:
cancel- if true, the TestSubscriber will be cancelled before subscribing to this Solo- Returns:
- the new TestSubscriber instance
-
test
public final TestSubscriber<T> test(long initialRequest)
Creates a TestSubscriber with the given initial request and subscribes it to this Solo.- Parameters:
initialRequest- the initial request amount, non-negative- Returns:
- the new TestSubscriber
-
test
public final TestSubscriber<T> test(long initialRequest, boolean cancel)
Creates a TestSubscriber with the given initial request, optionally cancels it, and subscribes it to this Solo.- Parameters:
initialRequest- the initial request amount, non-negativecancel- if true, the TestSubscriber will be cancelled before subscribing to this Solo- Returns:
- the new TestSubscriber
-
toFuture
public final java.util.concurrent.Future<T> toFuture()
Converts this Solo into a Future and signals its single value.- Returns:
- the new Future instance
-
-