Browse Source

Optimize ParameterUtils.curingGlobalParams() execution efficiency (#2090)

* Optimize ParameterUtils.curingGlobalParams() execution efficiency

* Remove excess null check
pull/2/head
dailidong 5 years ago committed by GitHub
parent
commit
1f92b4c4db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java

14
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java

@ -119,6 +119,11 @@ public class ParameterUtils {
*/
public static String curingGlobalParams(Map<String,String> globalParamMap, List<Property> globalParamList,
CommandType commandType, Date scheduleTime){
if (globalParamList == null || globalParamList.isEmpty()) {
return null;
}
Map<String, String> globalMap = new HashMap<>();
if (globalParamMap!= null){
globalMap.putAll(globalParamMap);
@ -132,9 +137,7 @@ public class ParameterUtils {
allParamMap.putAll(timeParams);
}
if (globalMap != null) {
allParamMap.putAll(globalMap);
}
Set<Map.Entry<String, String>> entries = allParamMap.entrySet();
@ -146,12 +149,7 @@ public class ParameterUtils {
resolveMap.put(entry.getKey(),str);
}
}
if (globalMap != null){
globalMap.putAll(resolveMap);
}
if (globalParamList != null && globalParamList.size() > 0){
for (Property property : globalParamList){
String val = globalMap.get(property.getProp());
@ -161,8 +159,6 @@ public class ParameterUtils {
}
return JSONObject.toJSONString(globalParamList);
}
return null;
}
/**

Loading…
Cancel
Save