RxJava offers standard repeat operators that allow you to repeat several times, repeat if the exception matches the predicate or has complex repeat logic. The first two uses are the simplest:
source.retry(5).subscribe(...) source.retry(e -> e instanceof IOException).subscribe(...);
The latter requires the assembly of a secondary observable, which can now have delays, counters, etc .:
source.retryWhen(o -> o.delay(100, TimeUnit.MILLISECONDS)).subscribe(...)
source share