Skip to content

Commit bc8bc52

Browse files
committed
fix: multi threading on MethodResolver
1 parent 10309d3 commit bc8bc52

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test-app/runtime/src/main/java/com/tns/MethodResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.HashMap;
1212
import java.util.List;
1313
import java.util.Map;
14+
import java.util.concurrent.ConcurrentHashMap;
1415

1516
class MethodResolver {
1617
private static Map<String, String> primitiveTypesSignature = new HashMap<String, String>();
@@ -98,11 +99,10 @@ public static String getTypeSignature(Class<?> type) {
9899
return array + signature;
99100
}
100101

101-
static HashMap<Class<?>, MethodFinder> methodOverloadsForClass = new HashMap<Class<?>, MethodFinder>();
102-
static ArrayList<Tuple<Method, Integer>> candidates = new ArrayList<Tuple<Method, Integer>>();
102+
static ConcurrentHashMap<Class<?>, MethodFinder> methodOverloadsForClass = new ConcurrentHashMap<>();
103103

104104
static String resolveMethodOverload(Class<?> clazz, String methodName, Object[] args) throws ClassNotFoundException {
105-
candidates.clear();
105+
ArrayList<Tuple<Method, Integer>> candidates = new ArrayList<Tuple<Method, Integer>>();
106106
int argLength = (args != null) ? args.length : 0;
107107

108108
Class<?> c = clazz;

0 commit comments

Comments
 (0)