This repository was archived by the owner on Mar 30, 2019. It is now read-only.
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
RetryOn ignored due to wrong command order #3
Closed
Description
Hey Tomasz,
Throwing a "UploadResponseException with status code 503":
The abortIf predicate will return false
Tested in java7 backport.
Example order 1 (failing):
final RetryExecutor executor = new AsyncRetryExecutor(schedueler).withExponentialBackoff(5000, 2)
.withMaxDelay(30000)
.withMaxRetries(2)
.retryOn(IOException.class)
.retryOn(RuntimeException.class)
.abortIf(new Predicate<Throwable>() {
@Override
public boolean apply(@Nullable final Throwable input) {
boolean instance = input instanceof UploadResponseException;
System.out.println("Instance: " + instance);
if (instance) {
boolean test = SC_500 >= ((UploadResponseException) input).getStatus();
System.out.println("Test: " + test);
return test;
}
return false;
}
})
.retryOn(UploadResponseException.class)
.abortOn(MetaBadRequestException.class)
.abortOn(FileNotFoundException.class)
.abortOn(UploadFinishedException.class);
Example order 2 (working):
final RetryExecutor executor = new AsyncRetryExecutor(schedueler).withExponentialBackoff(5000, 2)
.withMaxDelay(30000)
.withMaxRetries(2)
.retryOn(IOException.class)
.retryOn(RuntimeException.class)
.retryOn(UploadResponseException.class)
.abortIf(new Predicate<Throwable>() {
@Override
public boolean apply(@Nullable final Throwable input) {
boolean instance = input instanceof UploadResponseException;
System.out.println("Instance: " + instance);
if (instance) {
boolean test = SC_500 >= ((UploadResponseException) input).getStatus();
System.out.println("Test: " + test);
return test;
}
return false;
}
})
.abortOn(FileNotFoundException.class)
.abortOn(UploadFinishedException.class);
Seems like my retryOn is ignored if using the wrong order.
It'd be nice to have compile time check for correct order (like typeof) or to fix this bug.
Metadata
Metadata
Assignees
Labels
No labels