Skip to content

Commit

Permalink
Ensure that DependencyResolver is thread safe
Browse files Browse the repository at this point in the history
  • Loading branch information
mhalbritter committed Aug 21, 2024
1 parent 4542e80 commit 7900339
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -62,7 +63,7 @@

final class DependencyResolver {

private static final Collection<DependencyResolver> instances = new ArrayList<>();
private static final Collection<DependencyResolver> instances = new CopyOnWriteArrayList<>();

private static final ThreadLocal<DependencyResolver> instanceForThread = ThreadLocal.withInitial(() -> {
DependencyResolver instance = new DependencyResolver();
Expand Down

0 comments on commit 7900339

Please sign in to comment.