/** * Signals a 0L after the specified amount of time has passed since * subscription. * @param delay the delay time * @param unit the time unit * @return the new Solo instance */ public static Solo<Long> timer(long delay, TimeUnit unit) { return timer(delay, unit, Schedulers.computation()); }
/** * Fall back to another Solo if this Solo doesn't signal within the given * time period. * @param timeout the timeout value * @param unit the time unit * @param fallback the other Solo to subscribe to * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit, Solo<T> fallback) { return timeout(timer(timeout, unit), fallback); }
/** * Signals a 0L after the specified amount of time has passed since * subscription. * @param delay the delay time * @param unit the time unit * @return the new Solo instance */ public static Solo<Long> timer(long delay, TimeUnit unit) { return timer(delay, unit, Schedulers.computation()); }
/** * Delay the subscription to this Solo until the specified delay elapses. * @param delay the delay time * @param unit the delay unit * @return the new Solo type */ public final Solo<T> delaySubscription(long delay, TimeUnit unit) { return delaySubscription(timer(delay, unit)); }
/** * Signal a TimeoutException if there is no item from this Solo within * the given timeout time. * @param timeout the timeout value * @param unit the time unit * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit) { return timeout(timer(timeout, unit)); }
/** * Delay the subscription to this Solo until the specified delay elapses. * @param delay the delay time * @param unit the delay unit * @param scheduler the scheduler to wait on * @return the new Solo type */ public final Solo<T> delaySubscription(long delay, TimeUnit unit, Scheduler scheduler) { return delaySubscription(timer(delay, unit, scheduler)); }
/** * Delay the subscription to this Solo until the specified delay elapses. * @param delay the delay time * @param unit the delay unit * @return the new Solo type */ public final Solo<T> delaySubscription(long delay, TimeUnit unit) { return delaySubscription(timer(delay, unit)); }
/** * Signal a TimeoutException if there is no item from this Solo within * the given timeout time, running on the specified scheduler. * @param timeout the timeout value * @param unit the time unit * @param scheduler the scheduler to wait on * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit, Scheduler scheduler) { return timeout(timer(timeout, unit, scheduler)); }
/** * Fall back to another Solo if this Solo doesn't signal within the given * time period, waiting on the specified scheduler. * @param timeout the timeout value * @param unit the time unit * @param scheduler the scheduler to wait on * @param fallback the fallback Solo to subscribe to * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit, Scheduler scheduler, Solo<T> fallback) { return timeout(timer(timeout, unit, scheduler), fallback); }
/** * Signal a TimeoutException if there is no item from this Solo within * the given timeout time. * @param timeout the timeout value * @param unit the time unit * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit) { return timeout(timer(timeout, unit)); }
/** * Fall back to another Solo if this Solo doesn't signal within the given * time period, waiting on the specified scheduler. * @param timeout the timeout value * @param unit the time unit * @param scheduler the scheduler to wait on * @param fallback the fallback Solo to subscribe to * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit, Scheduler scheduler, Solo<T> fallback) { return timeout(timer(timeout, unit, scheduler), fallback); }
/** * Signal a TimeoutException if there is no item from this Solo within * the given timeout time, running on the specified scheduler. * @param timeout the timeout value * @param unit the time unit * @param scheduler the scheduler to wait on * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit, Scheduler scheduler) { return timeout(timer(timeout, unit, scheduler)); }
/** * Fall back to another Solo if this Solo doesn't signal within the given * time period. * @param timeout the timeout value * @param unit the time unit * @param fallback the other Solo to subscribe to * @return the new Solo instance */ public final Solo<T> timeout(long timeout, TimeUnit unit, Solo<T> fallback) { return timeout(timer(timeout, unit), fallback); }
/** * Delay the subscription to this Solo until the specified delay elapses. * @param delay the delay time * @param unit the delay unit * @param scheduler the scheduler to wait on * @return the new Solo type */ public final Solo<T> delaySubscription(long delay, TimeUnit unit, Scheduler scheduler) { return delaySubscription(timer(delay, unit, scheduler)); }
/** * Delay the emission of the signal of this Solo with the specified * time amount on the specified scheduler. * @param delay the delay time * @param unit the delay time unit * @param scheduler the scheduler to wait on * @return the new Solo instance */ public final Solo<T> delay(long delay, TimeUnit unit, Scheduler scheduler) { ObjectHelper.requireNonNull(unit, "unit is null"); ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return delay(timer(delay, unit, scheduler)); }
/** * Delay the emission of the signal of this Solo with the specified * time amount on the specified scheduler. * @param delay the delay time * @param unit the delay time unit * @param scheduler the scheduler to wait on * @return the new Solo instance */ public final Solo<T> delay(long delay, TimeUnit unit, Scheduler scheduler) { ObjectHelper.requireNonNull(unit, "unit is null"); ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return delay(timer(delay, unit, scheduler)); }
@Test public void timer() { Solo.timer(100, TimeUnit.MILLISECONDS) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(0L); }
@Test public void timerScheduler() { Solo.timer(100, TimeUnit.MILLISECONDS, Schedulers.single()) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(0L); }