RexXiong commented on code in PR #2075:
URL: 
https://github.com/apache/incubator-celeborn/pull/2075#discussion_r1383289714


##########
client/src/main/scala/org/apache/celeborn/client/ApplicationHeartbeater.scala:
##########
@@ -96,8 +99,31 @@ class ApplicationHeartbeater(
     }
   }
 
+  private def unregisterApplication(): Unit = {
+    try {
+      // Then unregister Application
+      logInfo(s"Unregister Application when $appId shutdown")
+      masterClient.askSync[ApplicationLostResponse](
+        ApplicationLost(appId),
+        classOf[ApplicationLostResponse])
+    } catch {
+      case e: Exception =>
+        logWarning("AskSync unRegisterApplication failed.", e)
+    }
+  }
+
   def stop(): Unit = {
-    appHeartbeat.cancel(true)
-    ThreadUtils.shutdown(appHeartbeatHandlerThread, 800.millis)
+    stopped.synchronized {
+      if (!stopped) {
+        // Stop appHeartbeat first
+        logInfo(s"Stop Application heartbeat $appId")
+        appHeartbeat.cancel(true)
+        ThreadUtils.shutdown(appHeartbeatHandlerThread, 800.millis)

Review Comment:
   > Could this grace period be configurable?
   
   No, the appHeartbeat task associated with this thread pool is probably 
already cancelled or interrupt.



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