Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid race condition by using ConcurrentHashMap #2435

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Member;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;

import javax.enterprise.context.Dependent;
Expand Down Expand Up @@ -92,7 +92,7 @@ abstract class InterceptorBase<T extends Metric, A extends Annotation> {
private final Function<A, String> nameFunction;
private final Function<A, String[]> tagsFunction;
private final Function<A, Boolean> isAbsoluteFunction;
private final Map<AnnotatedElement, T> elementMetricMap = new HashMap<>();
private final Map<AnnotatedElement, T> elementMetricMap = new ConcurrentHashMap<>();
private final String metricTypeName;
private final Class<T> metricClass;
private final Map<String, String> universalTags; // Get global and app tags for later
Expand Down