private static Func1<Observable<? extends Throwable>, Observable<?>> notificationHandler( final Observable<Long> delays, final Scheduler scheduler, final Action1<? super ErrorAndDuration> action, final List<Class<? extends Throwable>> retryExceptions, final List<Class<? extends Throwable>> failExceptions, final Func1<? super Throwable, Boolean> exceptionPredicate) { final Func1<ErrorAndDuration, Observable<ErrorAndDuration>> checkExceptions = createExceptionChecker( retryExceptions, failExceptions, exceptionPredicate); return createNotificationHandler(delays, scheduler, action, checkExceptions); }
public static Observable<String> from(Func0<Socket> socketCreator, long quietTimeoutMs, long reconnectDelayMs, Charset charset, Scheduler scheduler) { return strings(socketCreator, charset) // // additional timeout appears to be necessary for certain use // cases like when the server side does not close the socket .timeout(quietTimeoutMs + 100, TimeUnit.MILLISECONDS) // .subscribeOn(scheduler) // // if any exception occurs retry .retryWhen(RetryWhen // .delay(reconnectDelayMs, TimeUnit.MILLISECONDS) // .build()) // // all subscribers use the same stream .share(); }
private static Func1<Observable<? extends Throwable>, Observable<?>> notificationHandler( final Observable<Long> delays, final Scheduler scheduler, final Action1<? super ErrorAndDuration> action, final List<Class<? extends Throwable>> retryExceptions, final List<Class<? extends Throwable>> failExceptions, final Func1<? super Throwable, Boolean> exceptionPredicate) { final Func1<ErrorAndDuration, Observable<ErrorAndDuration>> checkExceptions = createExceptionChecker( retryExceptions, failExceptions, exceptionPredicate); return createNotificationHandler(delays, scheduler, action, checkExceptions); }