@@ -48,8 +48,8 @@ public class SyncFailsafe<R> extends FailsafeConfig<R, SyncFailsafe<R>> {
48
48
* exceeded.
49
49
*
50
50
* @throws NullPointerException if the {@code callable} is null
51
- * @throws FailsafeException if the {@code callable} fails with a Throwable and the retry policy is exceeded, or if
52
- * interrupted while waiting to perform a retry.
51
+ * @throws FailsafeException if the {@code callable} fails with a checked Exception or if interrupted while waiting to
52
+ * perform a retry.
53
53
* @throws CircuitBreakerOpenException if a configured circuit is open.
54
54
*/
55
55
public <T > T get (Callable <T > callable ) {
@@ -61,8 +61,8 @@ public <T> T get(Callable<T> callable) {
61
61
* exceeded.
62
62
*
63
63
* @throws NullPointerException if the {@code callable} is null
64
- * @throws FailsafeException if the {@code callable} fails with a Throwable and the retry policy is exceeded, or if
65
- * interrupted while waiting to perform a retry.
64
+ * @throws FailsafeException if the {@code callable} fails with a checked Exception or if interrupted while waiting to
65
+ * perform a retry.
66
66
* @throws CircuitBreakerOpenException if a configured circuit is open.
67
67
*/
68
68
public <T > T get (ContextualCallable <T > callable ) {
@@ -73,8 +73,8 @@ public <T> T get(ContextualCallable<T> callable) {
73
73
* Executes the {@code runnable} until successful or until the configured {@link RetryPolicy} is exceeded.
74
74
*
75
75
* @throws NullPointerException if the {@code runnable} is null
76
- * @throws FailsafeException if the {@code callable} fails with a Throwable and the retry policy is exceeded, or if
77
- * interrupted while waiting to perform a retry.
76
+ * @throws FailsafeException if the {@code callable} fails with a checked Exception or if interrupted while waiting to
77
+ * perform a retry.
78
78
* @throws CircuitBreakerOpenException if a configured circuit is open.
79
79
*/
80
80
public void run (CheckedRunnable runnable ) {
@@ -85,8 +85,8 @@ public void run(CheckedRunnable runnable) {
85
85
* Executes the {@code runnable} until successful or until the configured {@link RetryPolicy} is exceeded.
86
86
*
87
87
* @throws NullPointerException if the {@code runnable} is null
88
- * @throws FailsafeException if the {@code callable } fails with a Throwable and the retry policy is exceeded, or if
89
- * interrupted while waiting to perform a retry.
88
+ * @throws FailsafeException if the {@code runnable } fails with a checked Exception or if interrupted while waiting to
89
+ * perform a retry.
90
90
* @throws CircuitBreakerOpenException if a configured circuit is open.
91
91
*/
92
92
public void run (ContextualRunnable runnable ) {
@@ -116,8 +116,8 @@ public AsyncFailsafe<R> with(Scheduler scheduler) {
116
116
/**
117
117
* Calls the {@code callable} synchronously, performing retries according to the {@code retryPolicy}.
118
118
*
119
- * @throws FailsafeException if the {@code callable} fails with a Throwable and the retry policy is exceeded or if
120
- * interrupted while waiting to perform a retry
119
+ * @throws FailsafeException if the {@code callable} fails with a checked Exception or if interrupted while waiting to
120
+ * perform a retry.
121
121
* @throws CircuitBreakerOpenException if a configured circuit breaker is open
122
122
*/
123
123
@ SuppressWarnings ("unchecked" )
@@ -156,7 +156,7 @@ private <T> T call(Callable<T> callable) {
156
156
return result ;
157
157
if (fallback != null )
158
158
return fallbackFor ((R ) result , failure );
159
- throw failure instanceof FailsafeException ? (FailsafeException ) failure : new FailsafeException (failure );
159
+ throw failure instanceof RuntimeException ? (RuntimeException ) failure : new FailsafeException (failure );
160
160
} else {
161
161
try {
162
162
Thread .sleep (execution .getWaitTime ().toMillis ());
@@ -175,7 +175,7 @@ private <T> T fallbackFor(R result, Throwable failure) {
175
175
try {
176
176
return (T ) fallback .apply (result , failure );
177
177
} catch (Exception e ) {
178
- throw e instanceof FailsafeException ? (FailsafeException ) e : new FailsafeException (e );
178
+ throw e instanceof RuntimeException ? (RuntimeException ) e : new FailsafeException (e );
179
179
}
180
180
}
181
181
}
0 commit comments