Skip to content

Commit c54a4f6

Browse files
Handle InterruptedException
1 parent a5e418d commit c54a4f6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/SeekableByteChannelPrefetcher.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public int read(ByteBuffer dst) throws IOException {
191191
try {
192192
src = fetch(position);
193193
} catch (InterruptedException e) {
194+
Thread.currentThread().interrupt();
194195
return 0;
195196
} catch (ExecutionException e) {
196197
throw new RuntimeException(e);
@@ -341,11 +342,12 @@ public void close() throws IOException {
341342
}
342343
}
343344
} catch (InterruptedException e) {
344-
System.out.println("Timed out while waiting for channels to close.");
345+
Thread.currentThread().interrupt();
345346
}
346347
try {
347348
exec.awaitTermination(60, TimeUnit.SECONDS);
348349
} catch (InterruptedException e) {
350+
Thread.currentThread().interrupt();
349351
exec.shutdownNow();
350352
}
351353
// Close all underlying channels

0 commit comments

Comments
 (0)