Skip to content

Commit

Permalink
feat(s3stream): wait for the background executor to close when shutti…
Browse files Browse the repository at this point in the history
…ng down the S3 storage (#876)

Signed-off-by: SSpirits <[email protected]>
  • Loading branch information
ShadowySpirits authored Jan 4, 2024
1 parent afb8e43 commit d0ed716
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions s3stream/src/main/java/com/automq/stream/s3/S3Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@ public void shutdown() {
}
deltaWAL.shutdownGracefully();
backgroundExecutor.shutdown();
try {
if (backgroundExecutor.awaitTermination(10, TimeUnit.SECONDS)) {
LOGGER.warn("await backgroundExecutor timeout 10s");
}
} catch (InterruptedException e) {
backgroundExecutor.shutdownNow();
LOGGER.warn("await backgroundExecutor close fail", e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void shutdown() {
LOGGER.warn("await streamObjectCompactionExecutor timeout 10s");
}
} catch (InterruptedException e) {
streamObjectCompactionScheduler.shutdownNow();
LOGGER.warn("await streamObjectCompactionExecutor close fail", e);
}

Expand Down

0 comments on commit d0ed716

Please sign in to comment.