diff --git a/src/main/java/io/reactivex/Completable.java b/src/main/java/io/reactivex/Completable.java
index fe4d886dcd..79fcc9b432 100644
--- a/src/main/java/io/reactivex/Completable.java
+++ b/src/main/java/io/reactivex/Completable.java
@@ -2090,7 +2090,7 @@ public final Completable retry(BiPredicate super Integer, ? super Throwable> p
*
Scheduler:
*
{@code retry} does not operate by default on a particular {@link Scheduler}.
*
- * @param times the number of times the returned Completable should retry this Completable
+ * @param times the number of times to resubscribe if the current Completable fails
* @return the new Completable instance
* @throws IllegalArgumentException if times is negative
*/
@@ -2110,7 +2110,7 @@ public final Completable retry(long times) {
*
{@code retry} does not operate by default on a particular {@link Scheduler}.
*
*
History: 2.1.8 - experimental
- * @param times the number of times the returned Completable should retry this Completable
+ * @param times the number of times to resubscribe if the current Completable fails
* @param predicate the predicate that is called with the latest throwable and should return
* true to indicate the returned Completable should resubscribe to this Completable.
* @return the new Completable instance
diff --git a/src/main/java/io/reactivex/Flowable.java b/src/main/java/io/reactivex/Flowable.java
index ff85859f99..550b2958ce 100644
--- a/src/main/java/io/reactivex/Flowable.java
+++ b/src/main/java/io/reactivex/Flowable.java
@@ -13399,7 +13399,7 @@ public final Flowable retry(BiPredicate super Integer, ? super Throwable> p
*
*
* @param count
- * number of retry attempts before failing
+ * the number of times to resubscribe if the current Flowable fails
* @return the source Publisher modified with retry logic
* @see ReactiveX operators documentation: Retry
*/
@@ -13420,7 +13420,7 @@ public final Flowable retry(long count) {
*
Scheduler:
*
{@code retry} does not operate by default on a particular {@link Scheduler}.
*
- * @param times the number of times to repeat
+ * @param times the number of times to resubscribe if the current Flowable fails
* @param predicate the predicate called with the failure Throwable and should return true to trigger a retry.
* @return the new Flowable instance
*/
diff --git a/src/main/java/io/reactivex/Maybe.java b/src/main/java/io/reactivex/Maybe.java
index e2266c6b50..c123aa2316 100644
--- a/src/main/java/io/reactivex/Maybe.java
+++ b/src/main/java/io/reactivex/Maybe.java
@@ -4031,7 +4031,7 @@ public final Maybe retry(BiPredicate super Integer, ? super Throwable> pred
*
*
* @param count
- * number of retry attempts before failing
+ * the number of times to resubscribe if the current Maybe fails
* @return the new Maybe instance
* @see ReactiveX operators documentation: Retry
*/
@@ -4048,7 +4048,7 @@ public final Maybe retry(long count) {
*
Scheduler:
*
{@code retry} does not operate by default on a particular {@link Scheduler}.
*
- * @param times the number of times to repeat
+ * @param times the number of times to resubscribe if the current Maybe fails
* @param predicate the predicate called with the failure Throwable and should return true to trigger a retry.
* @return the new Maybe instance
*/
diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java
index 148f96c87b..15b453cd45 100644
--- a/src/main/java/io/reactivex/Observable.java
+++ b/src/main/java/io/reactivex/Observable.java
@@ -11075,7 +11075,7 @@ public final Observable retry(BiPredicate super Integer, ? super Throwable>
*
*
* @param times
- * number of retry attempts before failing
+ * the number of times to resubscribe if the current Observable fails
* @return the source ObservableSource modified with retry logic
* @see ReactiveX operators documentation: Retry
*/
@@ -11093,7 +11093,7 @@ public final Observable retry(long times) {
*
Scheduler:
*
{@code retry} does not operate by default on a particular {@link Scheduler}.
*
- * @param times the number of times to repeat
+ * @param times the number of times to resubscribe if the current Observable fails
* @param predicate the predicate called with the failure Throwable and should return true to trigger a retry.
* @return the new Observable instance
*/
diff --git a/src/test/java/io/reactivex/completable/CompletableTest.java b/src/test/java/io/reactivex/completable/CompletableTest.java
index 4798973835..80f4b49d5a 100644
--- a/src/test/java/io/reactivex/completable/CompletableTest.java
+++ b/src/test/java/io/reactivex/completable/CompletableTest.java
@@ -2398,18 +2398,20 @@ public void retryTimes5Error() {
@Test(timeout = 5000)
public void retryTimes5Normal() {
- final AtomicInteger calls = new AtomicInteger(5);
+ final AtomicInteger calls = new AtomicInteger();
Completable c = Completable.fromAction(new Action() {
@Override
public void run() {
- if (calls.decrementAndGet() != 0) {
+ if (calls.incrementAndGet() != 6) {
throw new TestException();
}
}
}).retry(5);
c.blockingAwait();
+
+ assertEquals(6, calls.get());
}
@Test(expected = IllegalArgumentException.class)
diff --git a/src/test/java/io/reactivex/internal/operators/single/SingleMiscTest.java b/src/test/java/io/reactivex/internal/operators/single/SingleMiscTest.java
index c811291851..7b3a891680 100644
--- a/src/test/java/io/reactivex/internal/operators/single/SingleMiscTest.java
+++ b/src/test/java/io/reactivex/internal/operators/single/SingleMiscTest.java
@@ -27,7 +27,9 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
@@ -199,11 +201,13 @@ public boolean test(Integer i, Throwable e) throws Exception {
@Test
public void retryTimes() {
+ final AtomicInteger calls = new AtomicInteger();
+
Single.fromCallable(new Callable