From b46db6cc949411a5ee8df8b09d7aed0e7e23d065 Mon Sep 17 00:00:00 2001 From: Scott Strong Date: Tue, 15 Nov 2022 14:10:05 -0500 Subject: [PATCH 1/2] Using Teardown context instead of deprecated finalize --- .../src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java index efb742fb2cba..524356d93cc6 100644 --- a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java +++ b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java @@ -2369,8 +2369,8 @@ public void finishBundle() throws Exception { cleanUpStatementAndConnection(); } - @Override - protected void finalize() throws Throwable { + @Teardown + protected void tearDown() throws Exception { cleanUpStatementAndConnection(); } From 8c518b94c2c3f56a495d9b5fd7a3d9201378762c Mon Sep 17 00:00:00 2001 From: Scott Strong Date: Tue, 15 Nov 2022 14:28:45 -0500 Subject: [PATCH 2/2] making function public --- .../jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java index 524356d93cc6..97fd2a41ed17 100644 --- a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java +++ b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java @@ -2370,7 +2370,7 @@ public void finishBundle() throws Exception { } @Teardown - protected void tearDown() throws Exception { + public void tearDown() throws Exception { cleanUpStatementAndConnection(); }