You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@livy.apache.org by vanzin <gi...@git.apache.org> on 2018/11/29 00:57:15 UTC

[GitHub] incubator-livy pull request #117: [LIVY-502] Remove dependency on hive-exec

Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/incubator-livy/pull/117#discussion_r237315238
  
    --- 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 --
    
    Is this necessary? Seems like if needed, it's something that the main server class should handle (and then shut down all loaded plugins).


---