Skip to content
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
@dennisfischer

Description

@dennisfischer

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions