bowenliang123 commented on code in PR #6587:
URL: https://github.com/apache/kyuubi/pull/6587#discussion_r1718169205


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/operation/log/OperationLog.scala:
##########
@@ -51,17 +51,19 @@ object OperationLog extends Logging {
   /**
    * The operation log root directory, this directory will delete when JVM 
exit.
    */
-  def createOperationLogRootDirectory(session: Session): Unit = {
-    session.sessionManager.operationLogRoot.foreach { operationLogRoot =>
+  def createOperationLogRootDirectory(session: Session): Path = {
+    session.sessionManager.operationLogRoot.map { operationLogRoot =>
       val path = Paths.get(operationLogRoot, 
session.handle.identifier.toString)
       try {
         Files.createDirectories(path)
-        path.toFile.deleteOnExit()
+        FileExpirationUtils.deleteFileOnExit(path)
+        path
       } catch {
         case e: IOException =>
           error(s"Failed to create operation log root directory: $path", e)
+          null
       }
-    }
+    }.orNull

Review Comment:
   The existed code Line 86 has the similar usage with `operationLogRoot`.
   
https://github.com/apache/kyuubi/pull/6587/files#diff-7e407151fdede81d22e23cc44075af5ed3ce5d54c702a84cbbf74d54ac459537R86



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to