From reviews-return-117-archive-asf-public=cust-asf.ponee.io@livy.incubator.apache.org Thu Nov 29 11:08:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4123118066C for ; Thu, 29 Nov 2018 11:08:45 +0100 (CET) Received: (qmail 51883 invoked by uid 500); 29 Nov 2018 10:08:44 -0000 Mailing-List: contact reviews-help@livy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@livy.incubator.apache.org Delivered-To: mailing list reviews@livy.incubator.apache.org Received: (qmail 51865 invoked by uid 99); 29 Nov 2018 10:08:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2018 10:08:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 84DC9DFDA7; Thu, 29 Nov 2018 10:08:43 +0000 (UTC) From: mgaido91 To: reviews@livy.apache.org Reply-To: reviews@livy.apache.org References: In-Reply-To: Subject: [GitHub] incubator-livy pull request #117: [LIVY-502] Remove dependency on hive-exec Content-Type: text/plain Message-Id: <20181129100843.84DC9DFDA7@git1-us-west.apache.org> Date: Thu, 29 Nov 2018 10:08:43 +0000 (UTC) Github user mgaido91 commented on a diff in the pull request: https://github.com/apache/incubator-livy/pull/117#discussion_r237422303 --- Diff: thriftserver/server/src/main/scala/org/apache/livy/thriftserver/LivyThriftServer.scala --- @@ -114,24 +98,56 @@ object LivyThriftServer extends Logging { thriftServer.stop() thriftServer = null } + + def isHTTPTransportMode(livyConf: LivyConf): Boolean = { + val transportMode = livyConf.get(LivyConf.THRIFT_TRANSPORT_MODE) + transportMode != null && transportMode.equalsIgnoreCase("http") + } } class LivyThriftServer( private[thriftserver] val livyConf: LivyConf, private[thriftserver] val livySessionManager: InteractiveSessionManager, private[thriftserver] val sessionStore: SessionStore, - private[thriftserver] val accessManager: AccessManager) extends HiveServer2 { - override def init(hiveConf: HiveConf): Unit = { - this.cliService = new LivyCLIService(this) - super.init(hiveConf) + private[thriftserver] val accessManager: AccessManager) + extends ThriftService(classOf[LivyThriftServer].getName) with Logging { + + val cliService = new LivyCLIService(this) + + override def init(livyConf: LivyConf): Unit = { + addService(cliService) + val server = this + val oomHook = new Runnable() { + override def run(): Unit = { + server.stop() + } + } + val thriftCLIService = if (LivyThriftServer.isHTTPTransportMode(livyConf)) { + new ThriftHttpCLIService(cliService, oomHook) + } else { + new ThriftBinaryCLIService(cliService, oomHook) + } + addService(thriftCLIService) + super.init(livyConf) + Runtime.getRuntime.addShutdownHook(new Thread("LivyThriftServer Shutdown") { --- End diff -- yes, I moved it in the main server class, thanks. ---