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


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/util/FileExpirationUtils.scala:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.util
+
+import java.nio.file.{Path, Paths}
+import java.util
+import java.util.Collections
+import java.util.concurrent.atomic.AtomicBoolean
+
+import scala.collection.convert.ImplicitConversions.`collection asJava`
+
+import org.apache.kyuubi.Utils
+
+object FileExpirationUtils {
+  private lazy val isCleanupShutdownHookInstalled = {
+    addFilesCleanupOnExitShutdownHook()
+    new AtomicBoolean(true)
+  }
+
+  private lazy val files: util.Set[String] =
+    Collections.synchronizedSet(new util.LinkedHashSet[String]())

Review Comment:
   In fact, the `java.io.*` classes were one of the most controversial designs 
in the Java standard library, and the `java.nio.*` classes were later 
introduced in subsequent versions. Sometimes the JDK standard library does not 
follow common design patterns, especially parts closely related to the OS 
platform.
   
   I would suggest moving TempFileManager to the common module, and 
centralizing the logic into it. Guava dep is not an issue for me, as it has no 
real effects on the leaf modules, e.g. `kyuubi-server`, `spark-sql-engine`



-- 
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-unsubscr...@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org
For additional commands, e-mail: notifications-h...@kyuubi.apache.org

Reply via email to