Skip to content

Commit

Permalink
[FIXED JENKINS-16831] Use Queue.getApproximateItemsQuickly to avoid l…
Browse files Browse the repository at this point in the history
…ocks from UI.
  • Loading branch information
jglick authored and kohsuke committed Feb 16, 2013
1 parent 2efa709 commit d4230ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion changelog.html
Expand Up @@ -55,7 +55,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
Lock contention issue in build history view.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16831">issue 16831</a>)
<li class=bug>
Fixed the HTTP request thread saturation problem with Winstone.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16474">issue 16474</a>)
Expand Down
11 changes: 7 additions & 4 deletions core/src/main/java/hudson/widgets/BuildHistoryWidget.java
Expand Up @@ -27,8 +27,7 @@
import hudson.model.Queue.Item;
import hudson.model.Queue.Task;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
Expand Down Expand Up @@ -60,8 +59,12 @@ public Item getQueuedItem() {
* Returns the queue item if the owner is scheduled for execution in the queue, in REVERSE ORDER
*/
public List<Item> getQueuedItems() {
List<Item> list = new ArrayList<Item>(Jenkins.getInstance().getQueue().getItems(owner));
Collections.reverse(list);
LinkedList<Item> list = new LinkedList<Item>();
for (Item item : Jenkins.getInstance().getQueue().getApproximateItemsQuickly()) {
if (item.task == owner) {
list.push(item);
}
}
return list;
}
}

0 comments on commit d4230ff

Please sign in to comment.