You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by GitBox <gi...@apache.org> on 2022/11/01 03:40:39 UTC

[GitHub] [incubator-linkis] casionone commented on a diff in pull request #3740: [LinkisManager][EngineConn]EngineConn idle exit adds the steps to request the linkismanager service to clean up resources

casionone commented on code in PR #3740:
URL: https://github.com/apache/incubator-linkis/pull/3740#discussion_r1010044217


##########
linkis-computation-governance/linkis-engineconn/linkis-clustered-engineconn/linkis-once-engineconn/src/main/scala/org/apache/linkis/engineconn/once/executor/OnceExecutor.scala:
##########
@@ -178,24 +182,39 @@ trait ManageableOnceExecutor extends AccessibleExecutor with OnceExecutor with R
 
   def tryFailed(): Boolean = {
     if (isClosed) return true
-    logger.error(s"$getId has failed with old status $getStatus, now stop it.")
+    val msg = s"$getId has failed with old status $getStatus, now stop it."
+    logger.error(msg)
     Utils.tryFinally {
       this.ensureAvailable(transition(NodeStatus.Failed))
       close()
-    }(ShutdownHook.getShutdownHook.notifyStop())
+    }(stopOnceExecutor(msg))
     true
   }
 
   def trySucceed(): Boolean = {
     if (isClosed) return true
-    logger.warn(s"$getId has succeed with old status $getStatus, now stop it.")
+    val msg = s"$getId has succeed with old status $getStatus, now stop it."
+    logger.warn(msg)
     Utils.tryFinally {
       this.ensureAvailable(transition(NodeStatus.Success))
       close()
-    }(ShutdownHook.getShutdownHook.notifyStop())
+    }(stopOnceExecutor(msg))
     true
   }
 
+  private def stopOnceExecutor(msg: String): Unit = {
+    val engineReleaseRequest = new EngineConnReleaseRequest(
+      Sender.getThisServiceInstance,
+      Utils.getJvmUser,
+      msg,
+      EngineConnObject.getEngineCreationContext.getTicketId
+    )
+    Utils.tryAndWarn(Thread.sleep(500))

Review Comment:
   to wait close() action done?



-- 
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: notifications-unsubscribe@linkis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org