Skip to content

Commit bda4198

Browse files
committed
change: cleanup retry stacktraces
1 parent f2707da commit bda4198

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

c2me-base/src/main/java/com/ishland/c2me/base/common/util/RxJavaUtils.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ public class RxJavaUtils {
1616
List<Throwable> throwableList = Collections.synchronizedList(new ReferenceArrayList<>());
1717
throwableList.addAll(List.of(existingErrors));
1818
return errors -> errors.zipWith(Flowable.range(1, maxRetries + 1), (error, retryCount) -> {
19+
throwableList.add(error);
1920
if (retryCount > maxRetries) {
20-
final RuntimeException exception = new RuntimeException("Max retries reached", error);
21+
final RuntimeException exception = new StacklessRuntimeException("Max retries reached");
2122
throwableList.forEach(exception::addSuppressed);
2223
throw exception;
2324
}
24-
throwableList.add(error);
2525
return retryCount;
2626
}).flatMap(retryCount -> Flowable.timer((long) Math.pow(2, retryCount - 1) * initialDelayMillis, TimeUnit.MILLISECONDS));
2727
}
2828

29+
public static class StacklessRuntimeException extends RuntimeException {
30+
public StacklessRuntimeException(String message) {
31+
super(message, null, true, false);
32+
}
33+
}
34+
2935
}

0 commit comments

Comments
 (0)