Skip to content
Permalink
Browse files

Fixed: Use ‘ConcurrentHashMap’ to avoid ‘ConcurrentModificationExcept…

…ion’

(OFBIZ-11258)

When trying to load components in their dependency order the
‘toBeLoadedComponents’ map is modified while being iterated over which
is not safe for non-concurrent maps.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868665 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Oct 20, 2019
1 parent 8553f0b commit de7a855ff57efcee23bc2f27f920a5411e58ef40
@@ -28,11 +28,11 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

@@ -61,7 +61,7 @@
private String name;
private final AtomicBoolean loaded = new AtomicBoolean(false);
private final List<Classpath> componentsClassPath = new ArrayList<>();
private static Map<String, List<ComponentConfig.DependsOnInfo>> toBeLoadedComponents = new HashMap<>();
private static Map<String, List<ComponentConfig.DependsOnInfo>> toBeLoadedComponents = new ConcurrentHashMap<>();

@Override
public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException {

0 comments on commit de7a855

Please sign in to comment.
You can’t perform that action at this time.