You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by li...@apache.org on 2020/03/17 07:01:52 UTC

[incubator-dolphinscheduler] branch dev updated: Optimize PropertyUtils instantiation. (#2199)

This is an automated email from the ASF dual-hosted git repository.

lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 7dd126d   Optimize PropertyUtils instantiation. (#2199)
7dd126d is described below

commit 7dd126da71acc9f2b64cb44f8a53e69f0ee50487
Author: t1mon <17...@qq.com>
AuthorDate: Tue Mar 17 15:01:42 2020 +0800

     Optimize PropertyUtils instantiation. (#2199)
    
    * Optimize PropertyUtils instantiation.
    
    * Fix info error.
---
 .../org/apache/dolphinscheduler/common/utils/PropertyUtils.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
index 5c1011c..ca928c9 100644
--- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
+++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
@@ -43,13 +43,11 @@ public class PropertyUtils {
 
     private static final Properties properties = new Properties();
 
-    private static final PropertyUtils propertyUtils = new PropertyUtils();
-
-    private PropertyUtils(){
-        init();
+    private PropertyUtils() {
+        throw new IllegalStateException("PropertyUtils class");
     }
 
-    private void init(){
+    static {
         String[] propertyFiles = new String[]{COMMON_PROPERTIES_PATH};
         for (String fileName : propertyFiles) {
             InputStream fis = null;