Skip to content

Commit

Permalink
Synchronize addLibertyModule()
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Gooderham <[email protected]>
  • Loading branch information
turkeylurkey committed Jan 17, 2025
1 parent 6f7be9d commit 84be6e7
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/main/java/io/openliberty/tools/intellij/LibertyModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,21 @@ public LibertyModules rescanLibertyModules(Project project) {
* @param module LibertyModule
*/
public LibertyModule addLibertyModule(LibertyModule module) {
if (libertyModules.containsKey(module.getBuildFile())) {
// Update existing Liberty project, projectType module, name and validContainerVersion
// Do not update the build file (key), debugMode, shellWidget or customStartParams since
// they may modify saved run configs.
LibertyModule existing = libertyModules.get(module.getBuildFile());
existing.setProject(module.getProject());
existing.setProjectType(module.getProjectType());
existing.setName(module.getName());
existing.setValidContainerVersion(module.isValidContainerVersion());
} else {
libertyModules.put(module.getBuildFile(), module);
synchronized (libertyModules) {
if (libertyModules.containsKey(module.getBuildFile())) {
// Update existing Liberty project, projectType module, name and validContainerVersion
// Do not update the build file (key), debugMode, shellWidget or customStartParams since
// they may modify saved run configs.
LibertyModule existing = libertyModules.get(module.getBuildFile());
existing.setProject(module.getProject());
existing.setProjectType(module.getProjectType());
existing.setName(module.getName());
existing.setValidContainerVersion(module.isValidContainerVersion());
} else {
libertyModules.put(module.getBuildFile(), module);
}
return libertyModules.get(module.getBuildFile());
}
return libertyModules.get(module.getBuildFile());
}

/**
Expand Down

0 comments on commit 84be6e7

Please sign in to comment.