Skip to content

Commit

Permalink
S3 context should not call close on reset (#5390)
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotrashivam authored Apr 20, 2024
1 parent 279755e commit 1604287
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final SafeCloseable apply(@NotNull final Supplier<SafeCloseable> resource
public void close() {
if (resource != null) {
resource.close();
resource = null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Decompressor getDecompressor() {
public void close() {
if (decompressor != null) {
CodecPool.returnDecompressor(decompressor);
codecName = null;
decompressor = null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int fill(final long position, ByteBuffer dest) throws IOException {

private void reset() {
// Cancel all outstanding requests
close();
cancelOutstanding();
// Reset the internal state
uri = null;
size = UNINITIALIZED_SIZE;
Expand All @@ -154,6 +154,10 @@ public void close() {
if (log.isDebugEnabled()) {
log.debug().append("Closing context: ").append(ctxStr()).endl();
}
cancelOutstanding();
}

private void cancelOutstanding() {
for (int i = 0; i < requests.length; i++) {
if (requests[i] != null) {
requests[i].release();
Expand Down

0 comments on commit 1604287

Please sign in to comment.