aboutsummaryrefslogtreecommitdiff
path: root/sql/hive-thriftserver
diff options
context:
space:
mode:
authorSean Owen <sowen@cloudera.com>2016-10-07 10:31:41 -0700
committerShixiong Zhu <shixiong@databricks.com>2016-10-07 10:31:41 -0700
commitcff560755244dd4ccb998e0c56e81d2620cd4cff (patch)
tree3ceda00ee96a9c7717f88d6243e75be4b2076834 /sql/hive-thriftserver
parentdd16b52cf785ae06026bd00e8e6bedfffa791f5d (diff)
downloadspark-cff560755244dd4ccb998e0c56e81d2620cd4cff.tar.gz
spark-cff560755244dd4ccb998e0c56e81d2620cd4cff.tar.bz2
spark-cff560755244dd4ccb998e0c56e81d2620cd4cff.zip
[SPARK-17707][WEBUI] Web UI prevents spark-submit application to be finished
## What changes were proposed in this pull request? This expands calls to Jetty's simple `ServerConnector` constructor to explicitly specify a `ScheduledExecutorScheduler` that makes daemon threads. It should otherwise result in exactly the same configuration, because the other args are copied from the constructor that is currently called. (I'm not sure we should change the Hive Thriftserver impl, but I did anyway.) This also adds `sc.stop()` to the quick start guide example. ## How was this patch tested? Existing tests; _pending_ at least manual verification of the fix. Author: Sean Owen <sowen@cloudera.com> Closes #15381 from srowen/SPARK-17707.
Diffstat (limited to 'sql/hive-thriftserver')
-rw-r--r--sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java b/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
index 37e4845cce..341a7fdbb5 100644
--- a/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
+++ b/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
@@ -37,11 +37,15 @@ import org.apache.thrift.TProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.server.TServlet;
+import org.eclipse.jetty.server.AbstractConnectionFactory;
+import org.eclipse.jetty.server.ConnectionFactory;
+import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
+import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
public class ThriftHttpCLIService extends ThriftCLIService {
@@ -70,7 +74,8 @@ public class ThriftHttpCLIService extends ThriftCLIService {
httpServer = new org.eclipse.jetty.server.Server(threadPool);
// Connector configs
- ServerConnector connector = new ServerConnector(httpServer);
+
+ ConnectionFactory[] connectionFactories;
boolean useSsl = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_USE_SSL);
String schemeName = useSsl ? "https" : "http";
// Change connector if SSL is used
@@ -90,8 +95,21 @@ public class ThriftHttpCLIService extends ThriftCLIService {
Arrays.toString(sslContextFactory.getExcludeProtocols()));
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePassword);
- connector = new ServerConnector(httpServer, sslContextFactory);
+ connectionFactories = AbstractConnectionFactory.getFactories(
+ sslContextFactory, new HttpConnectionFactory());
+ } else {
+ connectionFactories = new ConnectionFactory[] { new HttpConnectionFactory() };
}
+ ServerConnector connector = new ServerConnector(
+ httpServer,
+ null,
+ // Call this full constructor to set this, which forces daemon threads:
+ new ScheduledExecutorScheduler("HiveServer2-HttpHandler-JettyScheduler", true),
+ null,
+ -1,
+ -1,
+ connectionFactories);
+
connector.setPort(portNum);
// Linux:yes, Windows:no
connector.setReuseAddress(!Shell.WINDOWS);