/** * Computes a checksum of the sharded file specified in the constructor. Not safe to call until * the writing is complete. */ private String getActualChecksum() { if (actualChecksum == null) { // Load output data List<String> outputs; try { outputs = shardedFile.readFilesWithRetries(Sleeper.DEFAULT, BACK_OFF_FACTORY.backoff()); } catch (Exception e) { throw new RuntimeException(String.format("Failed to read from: %s", shardedFile), e); } // Verify outputs. Checksum is computed using SHA-1 algorithm actualChecksum = computeHash(outputs); LOG.debug("Generated checksum: {}", actualChecksum); } return actualChecksum; }