CalvinKirs commented on a change in pull request #6130:
URL: https://github.com/apache/dolphinscheduler/pull/6130#discussion_r705831001



##########
File path: 
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
##########
@@ -90,16 +90,27 @@ public HadoopUtils load(String key) throws Exception {
     private Configuration configuration;
     private FileSystem fs;
 
-    private HadoopUtils() {
+    private HadoopUtils(boolean initial) {
+        if (!initial) {
+            return;
+        }
         init();
         initHdfsPath();
     }
 
+    private HadoopUtils() {
+        this(true);
+    }
+
     public static HadoopUtils getInstance() {
 
         return cache.getUnchecked(HADOOP_UTILS_KEY);
     }
 
+    public static HadoopUtils getInstanceForTest() {
+        return new HadoopUtils(false);
+    }
+

Review comment:
       I prefer other ways. Or it is recommended to refactor it, and it is not 
recommended to use static code blocks in this case.




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