Source:
<code>protected final Module loadModuleLocal(String name) throws ModuleLoadException { FutureModule futureModule = moduleMap.get(name); if (futureModule != null) { return futureModule.getModule(); } FutureModule newFuture = new FutureModule(name); futureModule = moduleMap.putIfAbsent(name, newFuture); if (futureModule != null) { return futureModule.getModule(); } boolean ok = false; try { final ModuleLogger log = Module.log; log.trace("Locally loading module %s from %s", name, this); final long startTime = Metrics.getCurrentCPUTime(); final ModuleSpec moduleSpec = findModule(name); loadTime.addAndGet(Metrics.getCurrentCPUTime() - startTime); if (moduleSpec == null) { log.trace("Module %s not found from %s", name, this); return null; } if (! moduleSpec.getName().equals(name)) { throw new ModuleLoadException("Module loader found a module with the wrong name"); } final Module module; if (moduleSpec instanceof AliasModuleSpec) { final AliasModuleSpec aliasModuleSpec = (AliasModuleSpec) moduleSpec; Module aliasedModule; while (true) { aliasedModule = loadModuleLocal(aliasModuleSpec.getAliasName()); if (aliasedModule == null) { throw new ModuleLoadException("Alias module " + name + " is referencing not existing module"); } final Set<String> aliases = aliasedModule.aliases; if (aliases == null) continue; synchronized (aliases) { if (aliases == aliasedModule.aliases) { aliases.add(moduleSpec.getName()); newFuture.setModule(module = aliasedModule); ok = true; break; } } } <START> } else { <END> module = defineModule((ConcreteModuleSpec) moduleSpec, newFuture); log.trace("Loaded module %s from %s", name, this); ok = true; } return module; } finally { if (! ok) { newFuture.setModule(null); moduleMap.remove(name, newFuture); } } }</code><technical_language>handy a trace statement in this if AliasModuleSpec branch too, break above. log.trace("Added module %s alias of %s %s", moduleSpec.getName(), aliasModuleSpec.getAliasName(), this);</technical_language>

Target:
protected final Module loadModuleLocal(String name) throws ModuleLoadException { FutureModule futureModule = moduleMap.get(name); if (futureModule != null) { return futureModule.getModule(); } FutureModule newFuture = new FutureModule(name); futureModule = moduleMap.putIfAbsent(name, newFuture); if (futureModule != null) { return futureModule.getModule(); } boolean ok = false; try { final ModuleLogger log = Module.log; log.trace("Locally loading module %s from %s", name, this); final long startTime = Metrics.getCurrentCPUTime(); final ModuleSpec moduleSpec = findModule(name); loadTime.addAndGet(Metrics.getCurrentCPUTime() - startTime); if (moduleSpec == null) { log.trace("Module %s not found from %s", name, this); return null; } if (! moduleSpec.getName().equals(name)) { throw new ModuleLoadException("Module loader found a module with the wrong name"); } final Module module; if (moduleSpec instanceof AliasModuleSpec) { final AliasModuleSpec aliasModuleSpec = (AliasModuleSpec) moduleSpec; Module aliasedModule; while (true) { aliasedModule = loadModuleLocal(aliasModuleSpec.getAliasName()); if (aliasedModule == null) { throw new ModuleLoadException("Alias module " + name + " is referencing not existing module"); } final Set<String> aliases = aliasedModule.aliases; if (aliases == null) continue; synchronized (aliases) { if (aliases == aliasedModule.aliases) { aliases.add(moduleSpec.getName()); newFuture.setModule(module = aliasedModule); log.trace("Added module %s as alias of %s from %s", moduleSpec.getName(), aliasModuleSpec.getAliasName(), this); ok = true; break; } } } } else { module = defineModule((ConcreteModuleSpec) moduleSpec, newFuture); log.trace("Loaded module %s from %s", name, this); ok = true; } return module; } finally { if (! ok) { newFuture.setModule(null); moduleMap.remove(name, newFuture); } } }