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


##########
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:
   @nileshrathi345 
   
   Why do we need this synchronized block? Could we avoid 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