Skip to content

Commit e409f9a

Browse files
committed
move service.start into try-catch
1 parent d5341ea commit e409f9a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,18 @@ private[thriftserver] trait ReflectedCompositeService { this: AbstractService =>
146146
service.start()
147147
serviceStartCount += 1
148148
}
149+
// Emulating `AbstractService.start`
150+
val startTime = new java.lang.Long(System.currentTimeMillis())
151+
setAncestorField(this, 3, "startTime", startTime)
152+
invoke(classOf[AbstractService], this, "ensureCurrentState", classOf[STATE] -> STATE.INITED)
153+
invoke(classOf[AbstractService], this, "changeState", classOf[STATE] -> STATE.STARTED)
154+
logInfo(s"Service: $getName is started.")
149155
} catch {
150156
case NonFatal(e) =>
151157
logError(s"Error starting services $getName", e)
152158
invoke(classOf[CompositeService], this, "stop",
153159
classOf[Int] -> new Integer(serviceStartCount))
154160
throw new ServiceException("Failed to Start " + getName, e)
155161
}
156-
157-
// Emulating `AbstractService.start`
158-
val startTime = new java.lang.Long(System.currentTimeMillis())
159-
setAncestorField(this, 3, "startTime", startTime)
160-
invoke(classOf[AbstractService], this, "ensureCurrentState", classOf[STATE] -> STATE.INITED)
161-
invoke(classOf[AbstractService], this, "changeState", classOf[STATE] -> STATE.STARTED)
162-
logInfo(s"Service: $getName is started.")
163162
}
164163
}

0 commit comments

Comments
 (0)