Source:
<code>private synchronized String loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.name); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.name, entry.getFileName(), alreadyLoadedEntry.getFileName() )); } try { entry.extension = new ExtensionProxy( loadExtension(props), ( new ExtMap().mput( Base.ContextKeys.GLOBAL_CONTEXT, globalContext ).mput( TRACE_LOG_CONTEXT_KEY, traceLog ).mput( Base.ContextKeys.INTERFACE_VERSION_MIN, 0 ).mput( Base.ContextKeys.INTERFACE_VERSION_MAX, Base.INTERFACE_VERSION_CURRENT ).mput( Base.ContextKeys.LOCALE, Locale.getDefault().toString() ).mput( Base.ContextKeys.CONFIGURATION, props ).mput( Base.ContextKeys.CONFIGURATION_SENSITIVE_KEYS, splitString(props.getProperty(Base.ConfigKeys.SENSITIVE_KEYS, "")) ).mput( Base.ContextKeys.INSTANCE_NAME, entry.name ).mput( Base.ContextKeys.PROVIDES, splitString(props.getProperty(Base.ConfigKeys.PROVIDES, "")) ) ) ); } catch (Exception e) { throw new RuntimeException(String.format("Error loading extension %1$s", entry.name)); } <START> loadedEntries.put(entry.name, entry); <END> setChanged(); notifyObservers(); return entry.name; }</code><technical_language>concurrent put if absent syncrhonize entire load</technical_language>

Target:
private String loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.name); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.name, entry.getFileName(), alreadyLoadedEntry.getFileName() )); } try { entry.extension = new ExtensionProxy( loadExtension(props), ( new ExtMap().mput( Base.ContextKeys.GLOBAL_CONTEXT, globalContext ).mput( TRACE_LOG_CONTEXT_KEY, traceLog ).mput( Base.ContextKeys.INTERFACE_VERSION_MIN, 0 ).mput( Base.ContextKeys.INTERFACE_VERSION_MAX, Base.INTERFACE_VERSION_CURRENT ).mput( Base.ContextKeys.LOCALE, Locale.getDefault().toString() ).mput( Base.ContextKeys.CONFIGURATION, props ).mput( Base.ContextKeys.CONFIGURATION_SENSITIVE_KEYS, splitString(props.getProperty(Base.ConfigKeys.SENSITIVE_KEYS, "")) ).mput( Base.ContextKeys.INSTANCE_NAME, entry.name ).mput( Base.ContextKeys.PROVIDES, splitString(props.getProperty(Base.ConfigKeys.PROVIDES, "")) ) ) ); ExtMap output = entry.extension.invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Base.InvokeCommands.LOAD ) ); if (output.<Integer>get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS) { throw new RuntimeException( String.format("Invoke of LOAD returned with error code: %1$s", output.<Integer>get(Base.InvokeKeys.RESULT) ) ); } } catch (Exception e) { throw new RuntimeException(String.format("Error loading extension %1$s", entry.name)); } loadedEntries.putIfAbsent(entry.name, entry); setChanged(); notifyObservers(); return entry.name; }