@@ -1151,24 +1151,27 @@ public V await() {
1151
1151
// At that point, we break the `await()` on the child task.
1152
1152
// Therefore, once we return from the following `await`,
1153
1153
// we just need to await again on the *current* child task to obtain the result of this task
1154
+
1154
1155
try {
1155
- this .getChildTask ().await ();
1156
+ return this .getChildTask ().await ();
1156
1157
} catch (OrchestratorBlockedException ex ) {
1157
1158
throw ex ;
1158
- } catch (Exception ignored ) {
1159
- // ignore the exception from previous child tasks.
1160
- // Only needs to return result from the last child task, which is on next line.
1159
+ } catch (Exception ex ) {
1161
1160
}
1162
- // Always return the last child task result.
1161
+
1163
1162
return this .getChildTask ().await ();
1164
1163
}
1165
1164
1166
1165
private boolean shouldRetry () {
1167
1166
if (this .lastFailure .isNonRetriable ()) {
1168
- return false ;
1167
+ logger .warning ("Not performing any retries because the error is non retriable" );
1168
+
1169
+ return false ;
1169
1170
}
1170
1171
1171
1172
if (this .policy != null ) {
1173
+ logger .warning ("Performing retires based on policy" );
1174
+
1172
1175
return this .shouldRetryBasedOnPolicy ();
1173
1176
} else if (this .handler != null ) {
1174
1177
RetryContext retryContext = new RetryContext (
@@ -1184,16 +1187,20 @@ private boolean shouldRetry() {
1184
1187
}
1185
1188
1186
1189
private boolean shouldRetryBasedOnPolicy () {
1190
+ logger .warning (this .attemptNumber + " retries out of total %d performed " + this .policy .getMaxNumberOfAttempts ());
1191
+
1187
1192
if (this .attemptNumber >= this .policy .getMaxNumberOfAttempts ()) {
1188
1193
// Max number of attempts exceeded
1189
1194
return false ;
1190
1195
}
1191
1196
1192
1197
// Duration.ZERO is interpreted as no maximum timeout
1193
1198
Duration retryTimeout = this .policy .getRetryTimeout ();
1199
+
1194
1200
if (retryTimeout .compareTo (Duration .ZERO ) > 0 ) {
1195
1201
Instant retryExpiration = this .firstAttempt .plus (retryTimeout );
1196
1202
if (this .context .getCurrentInstant ().compareTo (retryExpiration ) >= 0 ) {
1203
+
1197
1204
// Max retry timeout exceeded
1198
1205
return false ;
1199
1206
}
@@ -1374,6 +1381,7 @@ public boolean completeExceptionally(Throwable ex) {
1374
1381
Task <V > parentTask = this .getParentTask ();
1375
1382
boolean result = this .future .completeExceptionally (ex );
1376
1383
if (parentTask instanceof RetriableTask ) {
1384
+
1377
1385
// notify parent task
1378
1386
((RetriableTask <V >) parentTask ).handleChildException (ex );
1379
1387
}
0 commit comments