danielcweeks commented on code in PR #4912:
URL: https://github.com/apache/iceberg/pull/4912#discussion_r898538575


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3InputStream.java:
##########
@@ -88,23 +96,69 @@ public void seek(long newPos) {
 
   @Override
   public int read() throws IOException {
-    Preconditions.checkState(!closed, "Cannot read: already closed");
-    positionStream();
+    int[] byteRef = new int[1];
+    try {
+      Tasks.foreach(0)

Review Comment:
   This is a lot of duplicate code for the retry logic.  Could we consolidate 
to a method that wraps just the logic we want to execute?
   
   For example:
   
   ```java
   retry(() -> {
       Preconditions.checkState(!closed, "Cannot read: already closed");
       positionStream();
   
       byteRef[0] =  stream.read();
   })
   ```
   
   (you many have to use consumer/function for the range versions, but seems 
like there might be an more concise way to write this)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to