Skip to content

Commit

Permalink
Merge pull request #3198 from johnou/contention-JENKINS-48505
Browse files Browse the repository at this point in the history
[JENKINS-48505] - Invoke optimistic get before computeIfAbsent to avoid contention.
  • Loading branch information
oleg-nenashev committed Dec 16, 2017
2 parents 09bcc5d + dce450e commit 3a52963
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -2595,7 +2595,8 @@ public Injector getInjector() {
*/
@SuppressWarnings({"unchecked"})
public <T> ExtensionList<T> getExtensionList(Class<T> extensionType) {
return extensionLists.computeIfAbsent(extensionType, key -> ExtensionList.create(this, key));
ExtensionList<T> extensionList = extensionLists.get(extensionType);
return extensionList != null ? extensionList : extensionLists.computeIfAbsent(extensionType, key -> ExtensionList.create(this, key));
}

/**
Expand Down

0 comments on commit 3a52963

Please sign in to comment.