/** * Discovers all shards of this file using the provided {@link Sleeper} and {@link BackOff}. * * <p>Because of eventual consistency, reads may discover no files or fewer files than the * explicit list of files implies. In this case, the read is considered to have failed. */ @Override public List<String> readFilesWithRetries(Sleeper sleeper, BackOff backOff) throws IOException, InterruptedException { if (files.isEmpty()) { return Collections.emptyList(); } IOException lastException = null; do { try { // Read data from file paths return readLines(files); } catch (IOException e) { // Ignore and retry lastException = e; LOG.warn("Error in file reading. Ignore and retry."); } } while (BackOffUtils.next(sleeper, backOff)); // Failed after max retries throw new IOException( String.format("Unable to read file(s) after retrying %d times", MAX_READ_RETRIES), lastException); }