GP-0: Fix concurrency issue in TraceRmiTarget.

This commit is contained in:
Dan 2024-09-13 08:48:16 -04:00
parent f292bad0ed
commit 5f0e660c64

View File

@ -809,12 +809,14 @@ public class TraceRmiTarget extends AbstractTarget {
public MatchedMethod getBest(String name, ActionName action, public MatchedMethod getBest(String name, ActionName action,
Supplier<List<? extends MethodMatcher>> preferredSupplier) { Supplier<List<? extends MethodMatcher>> preferredSupplier) {
return map.computeIfAbsent(name, n -> chooseBest(action, preferredSupplier.get())); return getBest(name, action, preferredSupplier.get());
} }
public MatchedMethod getBest(String name, ActionName action, public MatchedMethod getBest(String name, ActionName action,
List<? extends MethodMatcher> preferred) { List<? extends MethodMatcher> preferred) {
return map.computeIfAbsent(name, n -> chooseBest(action, preferred)); synchronized (map) {
return map.computeIfAbsent(name, n -> chooseBest(action, preferred));
}
} }
private MatchedMethod chooseBest(ActionName name, List<? extends MethodMatcher> preferred) { private MatchedMethod chooseBest(ActionName name, List<? extends MethodMatcher> preferred) {