Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.
Open
Show file tree
Hide file tree
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 @@ -6,8 +6,8 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;

import java.lang.reflect.InvocationHandler;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import net.bytebuddy.ByteBuddy;
import net.bytebuddy.ClassFileVersion;
Expand All @@ -32,12 +32,12 @@
final class PageFragmentImplementation {

private static final Map<ClassLoader, Map<Class<? extends PageFragment>, Class<? extends PageFragment>>> CACHE =
new HashMap<>();
new ConcurrentHashMap<>();

static Class<? extends PageFragment> getOrCreate(Class<? extends PageFragment> pageFragmentType) {
ClassLoader classLoader = pageFragmentType.getClassLoader();
Map<Class<? extends PageFragment>, Class<? extends PageFragment>> implementationMap =
CACHE.computeIfAbsent(classLoader, cl -> new HashMap<>());
CACHE.computeIfAbsent(classLoader, cl -> new ConcurrentHashMap<>());
return implementationMap.computeIfAbsent(pageFragmentType, PageFragmentImplementation::create);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;

import java.lang.reflect.InvocationHandler;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import net.bytebuddy.ByteBuddy;
import net.bytebuddy.ClassFileVersion;
Expand All @@ -27,12 +27,12 @@

final class PageImplementation {

private static final Map<ClassLoader, Map<Class<? extends Page>, Class<? extends Page>>> CACHE = new HashMap<>();
private static final Map<ClassLoader, Map<Class<? extends Page>, Class<? extends Page>>> CACHE = new ConcurrentHashMap<>();

static Class<? extends Page> getOrCreate(Class<? extends Page> pageType) {
ClassLoader classLoader = pageType.getClassLoader();
Map<Class<? extends Page>, Class<? extends Page>> implementationMap =
CACHE.computeIfAbsent(classLoader, cl -> new HashMap<>());
CACHE.computeIfAbsent(classLoader, cl -> new ConcurrentHashMap<>());
return implementationMap.computeIfAbsent(pageType, PageImplementation::create);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import info.novatec.testit.webtester.browser.Browser;
import info.novatec.testit.webtester.events.EventListener;
Expand Down Expand Up @@ -57,7 +58,7 @@ private List<Field> getBrowserFields() {

private Map<String, Field> getNamedBrowserFieldsMap(List<Field> browserFields) {
Set<String> uniqueNames = new HashSet<>();
Map<String, Field> nameToFieldMap = new HashMap<>();
Map<String, Field> nameToFieldMap = new ConcurrentHashMap<>();
browserFields.forEach(field -> {
String browserName = field.getAnnotation(Managed.class).value();
if (uniqueNames.contains(browserName)) {
Expand Down