Skip to content

Commit 2a8e5d7

Browse files
committed
avoid repeat resolve file config
1 parent 7536424 commit 2a8e5d7

File tree

1 file changed

+7
-1
lines changed
  • apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/conf

1 file changed

+7
-1
lines changed

apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/conf/CustomizeConfiguration.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public enum CustomizeConfiguration {
6767
private static final Map<String, ElementMatcher> CONTEXT_ENHANCE_CLASSES = new HashMap<>();
6868
private static final AtomicBoolean LOAD_FOR_CONFIGURATION = new AtomicBoolean(false);
6969

70+
private static List<Map<String, Object>> RESOLVED_FILE_CONFIGURATIONS;
71+
7072
/**
7173
* The loadForEnhance method is resolver configuration file, and parse it
7274
*/
@@ -107,13 +109,17 @@ public synchronized void loadForConfiguration() {
107109
* @throws SAXException link {@link SAXException}
108110
*/
109111
private List<Map<String, Object>> resolver() throws ParserConfigurationException, IOException, SAXException {
112+
if (RESOLVED_FILE_CONFIGURATIONS != null) {
113+
return RESOLVED_FILE_CONFIGURATIONS;
114+
}
110115
List<Map<String, Object>> customizeMethods = new ArrayList<Map<String, Object>>();
111116
File file = new File(CustomizePluginConfig.Plugin.Customize.ENHANCE_FILE);
112117
if (file.exists() && file.isFile()) {
113118
NodeList classNodeList = resolverFileClassDesc(file);
114119
resolverClassNodeList(classNodeList, customizeMethods);
115120
}
116-
return customizeMethods;
121+
RESOLVED_FILE_CONFIGURATIONS = customizeMethods;
122+
return RESOLVED_FILE_CONFIGURATIONS;
117123
}
118124

119125
/**

0 commit comments

Comments
 (0)