Skip to content
Permalink
Browse files

Merge pull request #1971 from daspilker/JENKINS-31932

[JENKINS-31932] avoid synchronization for Jenkinsget/setJDKs
  • Loading branch information
daniel-beck committed Jan 8, 2016
2 parents 3f71632 + f7a0db5 commit 0a5b03688ba6884429bb3d2a06be8b7955694420
Showing with 14 additions and 5 deletions.
  1. +14 −5 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();
@@ -886,6 +886,17 @@ public void run(Reactor reactor) throws Exception {
executeReactor(null, graphBuilder);
}

/**
* Maintains backwards compatibility. Invoked by XStream when this object is de-serialized.
*/
@SuppressWarnings({"unused"})
private Object readResolve() {
if (jdks == null) {
jdks = new ArrayList<>();
}
return this;
}

/**
* Executes a reactor.
*
@@ -1663,9 +1674,7 @@ public String getDisplayName() {
return Messages.Hudson_DisplayName();
}

public synchronized List<JDK> getJDKs() {
if(jdks==null)
jdks = new ArrayList<JDK>();
public List<JDK> getJDKs() {
return jdks;
}

@@ -1676,7 +1685,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 0a5b036

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