Skip to content
Browse files
Fixed: Use ‘ConcurrentHashMap’ to avoid ‘ConcurrentModificationExcept…


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: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Oct 20, 2019
1 parent 8553f0b commit de7a855ff57efcee23bc2f27f920a5411e58ef40
Showing with 2 additions and 2 deletions.
  1. +2 −2 framework/base/src/main/java/org/apache/ofbiz/base/container/
@@ -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;

@@ -61,7 +61,7 @@ public class ComponentContainer implements Container {
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<>();

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

0 comments on commit de7a855

Please sign in to comment.