nileshrathi345 commented on code in PR #533:
URL: https://github.com/apache/livy/pull/533#discussion_r3665038051


##########
server/src/main/scala/org/apache/livy/utils/SparkYarnApp.scala:
##########
@@ -35,13 +38,22 @@ import org.apache.livy.{LivyConf, Logging, Utils}
 
 object SparkYarnApp extends Logging {
 
+  @volatile private var leakedAppsGCThreadStarted = false
+
   def init(livyConf: LivyConf, client: Option[YarnClient] = None): Unit = {
     mockYarnClient = client
     sessionLeakageCheckInterval = 
livyConf.getTimeAsMs(LivyConf.YARN_APP_LEAKAGE_CHECK_INTERVAL)
     sessionLeakageCheckTimeout = 
livyConf.getTimeAsMs(LivyConf.YARN_APP_LEAKAGE_CHECK_TIMEOUT)
-    leakedAppsGCThread.setDaemon(true)
-    leakedAppsGCThread.setName("LeakedAppsGCThread")
-    leakedAppsGCThread.start()
+    if (!leakedAppsGCThreadStarted) {
+      synchronized {

Review Comment:
   The synchronized block was added to just to make sure SparkYarnApp.init() is 
safe to call more than once for the unit tests.
   I have removed it and restore the previous behavior



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to