You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by li...@apache.org on 2017/05/10 07:46:39 UTC
hive git commit: HIVE-16593: SparkClientFactory.stop may prevent JVM
from exiting (Rui reviewed by Xuefu)
Repository: hive
Updated Branches:
refs/heads/master cde41e9ea -> 57ae3aca0
HIVE-16593: SparkClientFactory.stop may prevent JVM from exiting (Rui reviewed by Xuefu)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/57ae3aca
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/57ae3aca
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/57ae3aca
Branch: refs/heads/master
Commit: 57ae3aca05d21628df620f33a9f03966f33c8d7b
Parents: cde41e9
Author: Rui Li <li...@apache.org>
Authored: Wed May 10 15:46:31 2017 +0800
Committer: Rui Li <li...@apache.org>
Committed: Wed May 10 15:46:31 2017 +0800
----------------------------------------------------------------------
.../org/apache/hive/spark/client/SparkClientFactory.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/57ae3aca/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientFactory.java
----------------------------------------------------------------------
diff --git a/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientFactory.java b/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientFactory.java
index b23ff2d..cf60b13 100644
--- a/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientFactory.java
+++ b/spark-client/src/main/java/org/apache/hive/spark/client/SparkClientFactory.java
@@ -44,6 +44,7 @@ public final class SparkClientFactory {
static final String CONF_KEY_SECRET = "spark.client.authentication.secret";
private static RpcServer server = null;
+ private static final Object stopLock = new Object();
/**
* Initializes the SparkClient library. Must be called before creating client instances.
@@ -61,10 +62,14 @@ public final class SparkClientFactory {
}
/** Stops the SparkClient library. */
- public static synchronized void stop() {
+ public static void stop() {
if (server != null) {
- server.close();
- server = null;
+ synchronized (stopLock) {
+ if (server != null) {
+ server.close();
+ server = null;
+ }
+ }
}
}