Skip to content

Commit d90d564

Browse files
committed
Cache resolved methods in FunctionDelegatesFlowableFunctionResolver
1 parent 09f2e9b commit d90d564

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FunctionDelegatesFlowableFunctionResolver.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import java.lang.reflect.Method;
1616
import java.util.Collection;
17+
import java.util.HashMap;
1718
import java.util.LinkedHashMap;
1819
import java.util.Map;
1920

@@ -25,6 +26,7 @@
2526
public class FunctionDelegatesFlowableFunctionResolver implements FlowableFunctionResolver {
2627

2728
protected final Map<String, FlowableFunctionDelegate> functionDelegateMap;
29+
protected final Map<String, Method> functionsCache = new HashMap<>();
2830

2931
public FunctionDelegatesFlowableFunctionResolver(Collection<FlowableFunctionDelegate> functionDelegates) {
3032
functionDelegateMap = new LinkedHashMap<>();
@@ -41,7 +43,14 @@ public FunctionDelegatesFlowableFunctionResolver(Collection<FlowableFunctionDele
4143

4244
@Override
4345
public Method resolveFunction(String prefix, String localName) throws NoSuchMethodException {
44-
return resolveFunction(functionDelegateMap.get(prefix + ":" + localName), prefix, localName);
46+
String functionName = prefix + ":" + localName;
47+
if (functionsCache.containsKey(functionName)) {
48+
return functionsCache.get(functionName);
49+
}
50+
Method functionMethod = resolveFunction(functionDelegateMap.get(functionName), prefix, localName);
51+
functionsCache.put(functionName, functionMethod);
52+
return functionMethod;
53+
4554
}
4655

4756
protected Method resolveFunction(FlowableFunctionDelegate functionDelegate, String prefix, String localName) throws NoSuchMethodException {

0 commit comments

Comments
 (0)