Skip to content

Commit

Permalink
Cleanup bigtable open resources on teardown (#30453)
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones authored Mar 5, 2024

Verified

This commit was signed with the committer’s verified signature.
weiji14 Wei Ji
1 parent fa43f82 commit 6f8f12a
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1419,6 +1419,23 @@ public void finishBundle(FinishBundleContext c) throws Exception {
}
}

@Teardown
public void tearDown() throws IOException {
// in case of exception in processElement, finishBundle will not be called
// cleanup resources allocated in startBundle
try {
if (bigtableWriter != null) {
bigtableWriter.close();
bigtableWriter = null;
}
} finally {
if (serviceEntry != null) {
serviceEntry.close();
serviceEntry = null;
}
}
}

@Override
public void populateDisplayData(DisplayData.Builder builder) {
config.populateDisplayData(builder);

0 comments on commit 6f8f12a

Please sign in to comment.