Skip to content

Commit

Permalink
Improved: Pass directly the loaders to ‘loadContainersFromConfigurati…
Browse files Browse the repository at this point in the history
…ons’

(OFBIZ-11100)

Since only the loaders are used from the configuration, it is better
to pass those directly as a parameter to the
‘loadContainersFromConfigurations’ method instead of the full
configuration object.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863023 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jul 13, 2019
1 parent 5a7b0e6 commit 978ad32
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public synchronized void load(Config config, List<StartupCommand> ofbizCommands)

// Load containers defined in components.
Debug.logInfo("[Startup] Loading containers...", module);
loadedContainers.addAll(loadContainersFromConfigurations(config, ofbizCommands));
loadedContainers.addAll(loadContainersFromConfigurations(config.loaders, ofbizCommands));

// Start all containers loaded from above steps
startLoadedContainers();
Expand All @@ -93,16 +93,16 @@ private static boolean intersects(Collection<?> a, Collection<?> b) {
/**
* Loads the available containers which are matching the configured loaders.
*
* @param config the configuration defining the loaders to match
* @param loaders the collection of loaders to match
* @param ofbizCommands the parsed commands line arguments used by the containers
* @return a list of loaded containers.
* @throws StartupException when a container fails to load.
*/
private static List<Container> loadContainersFromConfigurations(Config config, List<StartupCommand> ofbizCommands)
throws StartupException {
private static List<Container> loadContainersFromConfigurations(Collection<String> loaders,
List<StartupCommand> ofbizCommands) throws StartupException {
List<Container> loadContainers = new ArrayList<>();
for (ContainerConfig.Configuration containerCfg : ComponentConfig.getAllConfigurations()) {
if (intersects(containerCfg.loaders, config.loaders)) {
if (intersects(containerCfg.loaders, loaders)) {
Debug.logInfo("Loading container: " + containerCfg.name, module);
Container tmpContainer = loadContainer(containerCfg, ofbizCommands);
loadContainers.add(tmpContainer);
Expand Down

0 comments on commit 978ad32

Please sign in to comment.