Skip to content
Permalink
Browse files

avoid synchronization for Jenkinsget/setJDKs, use a volatile field in…

…stead

[FIXES JENKINS-31932]
  • Loading branch information
daspilker committed Jan 7, 2016
1 parent 86ec658 commit 9a239081e945f9b1d3076bec59266d01f0857f47
Showing with 3 additions and 3 deletions.
  1. +3 −3 core/src/main/java/jenkins/model/Jenkins.java
@@ -431,7 +431,7 @@
private transient volatile boolean isQuietingDown;
private transient volatile boolean terminating;

private List<JDK> jdks = new ArrayList<JDK>();
private volatile List<JDK> jdks = new ArrayList<JDK>();

private transient volatile DependencyGraph dependencyGraph;
private final transient AtomicBoolean dependencyGraphDirty = new AtomicBoolean();
@@ -1663,7 +1663,7 @@ public String getDisplayName() {
return Messages.Hudson_DisplayName();
}

public synchronized List<JDK> getJDKs() {
public List<JDK> getJDKs() {
if(jdks==null)
jdks = new ArrayList<JDK>();
return jdks;
@@ -1676,7 +1676,7 @@ public String getDisplayName() {
* set JDK installations from external code.
*/
@Restricted(NoExternalUse.class)
public synchronized void setJDKs(Collection<? extends JDK> jdks) {
public void setJDKs(Collection<? extends JDK> jdks) {
this.jdks = new ArrayList<JDK>(jdks);
}

0 comments on commit 9a23908

Please sign in to comment.
You can’t perform that action at this time.