Hello Alexey Serbin, Grant Henke,
I'd like you to do a code review. Please visit
http://gerrit.cloudera.org:8080/12322
to review the following change.
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
---
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(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/22/12322/1
--
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: newchange
Gerrit-Change-Id: If91b3b2787915f0361537dd999e0daa8f7cb0a36
Gerrit-Change-Number: 12322
Gerrit-PatchSet: 1
Gerrit-Owner: Adar Dembo <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Grant Henke <[email protected]>