/** * Blockingly awaits indefinitely the success value of this Perhaps or rethrows * its error (wrapped into a RuntimeException if necessary). * @return the success value of this Perhaps */ public final T blockingGet() { BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); return s.blockingGet(); }
@Override public void onError(Throwable t) { error = t; countDown(); }
/** * Blocks until this Solo produces its terminal signal and calls the * appropriate callback(s) based on the signal type. * @param onNext called when the Solo succeeds * @param onError called when the Solo fails * @param onComplete called when the Solo succeeds after the call to onNext. */ public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete) { ObjectHelper.requireNonNull(onNext, "onNext is null"); ObjectHelper.requireNonNull(onError, "onError is null"); ObjectHelper.requireNonNull(onComplete, "onComplete is null"); BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); s.blockingCall(onNext, onError, onComplete); }
/** * Blocks until this Perhaps produces its terminal signal and calls the * appropriate callback(s) based on the signal type. * @param onNext called when the Perhaps succeeds * @param onError called when the Perhaps fails * @param onComplete called when the Perhaps succeeds after the call to onNext. */ public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete) { ObjectHelper.requireNonNull(onNext, "onNext is null"); ObjectHelper.requireNonNull(onError, "onError is null"); ObjectHelper.requireNonNull(onComplete, "onComplete is null"); BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); s.blockingCall(onNext, onError, onComplete); }
T blockingGet(long timeout, TimeUnit unit) { if (getCount() != 0) { try { if (!await(timeout, unit)) { dispose(); throw ExceptionHelper.wrapOrThrow(new TimeoutException()); } } catch (InterruptedException ex) { dispose(); throw ExceptionHelper.wrapOrThrow(ex); } } Throwable ex = error; if (ex != null) { throw ExceptionHelper.wrapOrThrow(ex); } return value; }
/** * Blockingly awaits indefinitely the success value of this Solo or rethrows * its error (wrapped into a RuntimeException if necessary). * @return the success value of this Solo */ public final T blockingGet() { BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); return s.blockingGet(); }
/** * Blocks until this Solo produces its terminal signal and calls the * appropriate callback(s) based on the signal type. * @param onNext called when the Solo succeeds * @param onError called when the Solo fails * @param onComplete called when the Solo succeeds after the call to onNext. */ public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete) { ObjectHelper.requireNonNull(onNext, "onNext is null"); ObjectHelper.requireNonNull(onError, "onError is null"); ObjectHelper.requireNonNull(onComplete, "onComplete is null"); BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); s.blockingCall(onNext, onError, onComplete); }
@Override public void onError(Throwable t) { error = t; countDown(); }
T blockingGet(long timeout, TimeUnit unit) { if (getCount() != 0) { try { if (!await(timeout, unit)) { dispose(); throw ExceptionHelper.wrapOrThrow(new TimeoutException()); } } catch (InterruptedException ex) { dispose(); throw ExceptionHelper.wrapOrThrow(ex); } } Throwable ex = error; if (ex != null) { throw ExceptionHelper.wrapOrThrow(ex); } return value; }
/** * Blockingly awaits indefinitely the success value of this Perhaps or rethrows * its error (wrapped into a RuntimeException if necessary). * @return the success value of this Perhaps */ public final T blockingGet() { BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); return s.blockingGet(); }
/** * Blocks until this Perhaps produces its terminal signal and calls the * appropriate callback(s) based on the signal type. * @param onNext called when the Perhaps succeeds * @param onError called when the Perhaps fails * @param onComplete called when the Perhaps succeeds after the call to onNext. */ public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete) { ObjectHelper.requireNonNull(onNext, "onNext is null"); ObjectHelper.requireNonNull(onError, "onError is null"); ObjectHelper.requireNonNull(onComplete, "onComplete is null"); BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); s.blockingCall(onNext, onError, onComplete); }
@Override public void onComplete() { countDown(); }
/** * Blockingly awaits indefinitely the success value of this Solo or rethrows * its error (wrapped into a RuntimeException if necessary). * @return the success value of this Solo */ public final T blockingGet() { BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); return s.blockingGet(); }
@Override public void onComplete() { countDown(); }
/** * Blockingly awaits at most the given timeout for the success * value of this Solo or rethrows * its error (wrapped into a RuntimeException if necessary). * @param timeout the time to wait for a success value * @param unit the time unit of the timeout * @return the success value of this Solo */ public final T blockingGet(long timeout, TimeUnit unit) { BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); return s.blockingGet(timeout, unit); }
/** * Blockingly awaits at most the given timeout for the success * value of this Perhaps or rethrows * its error (wrapped into a RuntimeException if necessary). * @param timeout the time to wait for a success value * @param unit the time unit of the timeout * @return the success value of this Perhaps */ public final T blockingGet(long timeout, TimeUnit unit) { BlockingGetSubscriber<T> s = new BlockingGetSubscriber<T>(); subscribe(s); return s.blockingGet(timeout, unit); }