juliuszsompolski commented on a change in pull request #28835: URL: https://github.com/apache/spark/pull/28835#discussion_r442250684
########## File path: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala ########## @@ -114,10 +134,31 @@ private[thriftserver] trait ReflectedCompositeService { this: AbstractService => invoke(classOf[AbstractService], this, "ensureCurrentState", classOf[STATE] -> STATE.NOTINITED) setAncestorField(this, 3, "hiveConf", hiveConf) invoke(classOf[AbstractService], this, "changeState", classOf[STATE] -> STATE.INITED) - if (HiveUtils.isHive23) { - getAncestorField[Logger](this, 3, "LOG").info(s"Service: $getName is inited.") - } else { - getAncestorField[Log](this, 3, "LOG").info(s"Service: $getName is inited.") + logInfo(s"Service: $getName is inited.") + } + + def startCompositeService(): Unit = { + // Emulating `CompositeService.start` + val serviceList = getAncestorField[JList[Service]](this, 2, "serviceList") + var serviceStartCount = 0 + try { + serviceList.asScala.foreach { service => + service.start() + serviceStartCount += 1 + } + } catch { + case NonFatal(e) => + logError(s"Error starting services $getName", e) + invoke(classOf[CompositeService], this, "stop", + classOf[Int] -> new Integer(serviceStartCount)) + throw new ServiceException("Failed to Start " + getName, e) } + + // Emulating `AbstractService.start` + val startTime = new java.lang.Long(System.currentTimeMillis()) + setAncestorField(this, 3, "startTime", startTime) + invoke(classOf[AbstractService], this, "ensureCurrentState", classOf[STATE] -> STATE.INITED) Review comment: This can throw IllegalStateException, and in the original implementation it is inside the try catch block, which would turn it into ServiceException. Let's do that as well just in case :-). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org