public T call()

in src/main/java/com/netflix/bdp/s3mper/common/RetryTask.java [68:98]


    public T call() throws Exception {
        ExecutorService executor = Executors.newSingleThreadExecutor();
        
        try {
            for (int attempt = 1; attempt <= maxRetries; attempt++) {
                try {
                    FutureTask<T> future = new FutureTask<T>(target);

                    executor.submit(future);

                    return future.get(timeout, TimeUnit.MILLISECONDS);
                } catch (InterruptedException ie) {
                    throw ie;
                } catch (CancellationException ce) {
                    throw ce;
                } catch (Exception e) {
                    log.warn(format("Call attempt failed (%d of %d)", attempt, maxRetries));

                    if(attempt == maxRetries) {
                        throw e;
                    }

                    Thread.sleep(backoff.next());
                }
            }
        } finally {
            executor.shutdown();
        }
        
        throw new RuntimeException("Unexpected retry call failure");
    }