Skip to content

Commit

Permalink
[FIXED JENKINS-16833] Use a CopyOnWriteArraySet for inProgress to avo…
Browse files Browse the repository at this point in the history
…id blocking UI.
  • Loading branch information
jglick authored and kohsuke committed Feb 16, 2013
1 parent f3a2ae3 commit 2efa709
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -68,6 +68,9 @@
<li class=bug>
maven-failsafe-plugin tests not recognized anymore
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16696">issue 16696</a>)
<li class=bug>
UI waiting on a queue lock to display cause of queue blockage.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16833">issue 16833</a>)
<li class=rfe>
JNLP slave installers can now work transparently with secured Jenkins.
(SECURITY-54 / despite the ticket marker, this is not a security vulnerability)
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/hudson/model/ResourceController.java
Expand Up @@ -26,10 +26,10 @@
import hudson.util.AdaptedIterator;

import java.util.Set;
import java.util.HashSet;
import java.util.Collection;
import java.util.AbstractCollection;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArraySet;

/**
* Controls mutual exclusion of {@link ResourceList}.
Expand All @@ -39,7 +39,7 @@ public class ResourceController {
/**
* {@link ResourceList}s that are used by activities that are in progress.
*/
private final Set<ResourceActivity> inProgress = new HashSet<ResourceActivity>();
private final Set<ResourceActivity> inProgress = new CopyOnWriteArraySet<ResourceActivity>();

/**
* View of {@link #inProgress} that exposes its {@link ResourceList}.
Expand Down Expand Up @@ -125,7 +125,7 @@ public synchronized Resource getMissingResource(ResourceList resources) {
* the given activity, or null if it's not blocked (and thus the
* given activity can be executed immediately.)
*/
public synchronized ResourceActivity getBlockingActivity(ResourceActivity activity) {
public ResourceActivity getBlockingActivity(ResourceActivity activity) {
ResourceList res = activity.getResourceList();
for (ResourceActivity a : inProgress)
if(res.isCollidingWith(a.getResourceList()))
Expand Down

0 comments on commit 2efa709

Please sign in to comment.