Adar Dembo has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/12322 )
Change subject: [java] better client and minicluster cleanup after tests finish ...................................................................... [java] better client and minicluster cleanup after tests finish Many tests create their own client and minicluster instances, but don't take care to close them properly in all cases. This patch fixes that by: 1. Converting all temporary instantations to use try-with-resources. 2. For non-temporary instantiations, ensuring that close is always called, even if an exception is thrown mid-cleanup. The most interesting change is probably to KuduContext.scala, where we now close clients when clearing out the KuduClientCache (called by an @After). To avoid double closing, we need to unregister a client's shutdown hook after closing it. Change-Id: If91b3b2787915f0361537dd999e0daa8f7cb0a36 Reviewed-on: http://gerrit.cloudera.org:8080/12322 Tested-by: Kudu Jenkins Reviewed-by: Alexey Serbin <[email protected]> Reviewed-by: Grant Henke <[email protected]> --- M java/kudu-client/src/test/java/org/apache/kudu/client/TestAsyncKuduClient.java M java/kudu-client/src/test/java/org/apache/kudu/client/TestConnectToCluster.java M java/kudu-client/src/test/java/org/apache/kudu/client/TestConnectionCache.java M java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java M java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurity.java M java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeouts.java M java/kudu-flume-sink/src/main/java/org/apache/kudu/flume/sink/KuduSink.java M java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduContext.scala M java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java M java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java 10 files changed, 196 insertions(+), 200 deletions(-) Approvals: Kudu Jenkins: Verified Alexey Serbin: Looks good to me, but someone else must approve Grant Henke: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/12322 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: If91b3b2787915f0361537dd999e0daa8f7cb0a36 Gerrit-Change-Number: 12322 Gerrit-PatchSet: 2 Gerrit-Owner: Adar Dembo <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Grant Henke <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120)
