Closed
Description
Hi, can somebody explain me why following piece of code printing only two times message "Retrying"? And not 5 times as specified in predicate?
BTW if i uncomment doOnError line in this sample - i got 5 times message "Retrying".
Any ideas what's going on here?
Observable.just(1)
.map(value -> { throw new RuntimeException("You shall not pass"); })
// .doOnError(t -> System.out.println("Handling error"))
.retry((counter, throwable) -> {
System.out.println("Retrying");
return counter < 5;
})
.toBlocking()
.single();