mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
Fixed the lock contention problem on Queue.getItems()
From what I was told by Emanuele today in the office hours, this came up during the Copenhagen hackathon.
This commit is contained in:
1 parent
8891c86af6
commit
f1aa7ba07e
9 files changed
+90
-12
No files matched your search
@@ -29,7 +29,6 @@ import static hudson.model.ItemGroupMixIn.loadChildren;
|
||||
import hudson.CopyOnWrite;
|
||||
import hudson.EnvVars;
|
||||
import hudson.Extension;
|
||||
import hudson.ExtensionList;
|
||||
import hudson.FilePath;
|
||||
import hudson.Functions;
|
||||
import hudson.Indenter;
|
||||
@@ -60,7 +59,6 @@ import hudson.model.TopLevelItem;
|
||||
import hudson.search.CollectionSearchIndex;
|
||||
import hudson.search.SearchIndexBuilder;
|
||||
import hudson.tasks.BuildStep;
|
||||
import hudson.tasks.BuildStepDescriptor;
|
||||
import hudson.tasks.BuildWrapper;
|
||||
import hudson.tasks.BuildWrappers;
|
||||
import hudson.tasks.Builder;
|
||||
@@ -993,8 +991,19 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
|
||||
* Returns the {@link MavenModule}s that are in the queue.
|
||||
*/
|
||||
public List<Queue.Item> getQueueItems() {
|
||||
List<Queue.Item> r = new ArrayList<hudson.model.Queue.Item>();
|
||||
for( Queue.Item item : Jenkins.getInstance().getQueue().getItems() ) {
|
||||
return filter(Arrays.asList(Jenkins.getInstance().getQueue().getItems()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link MavenModule}s that are in the queue.
|
||||
*/
|
||||
public List<Queue.Item> getApproximateQueueItemsQuickly() {
|
||||
return filter(Jenkins.getInstance().getQueue().getApproximateItemsQuickly());
|
||||
}
|
||||
|
||||
private List<Queue.Item> filter(Collection<Queue.Item> base) {
|
||||
List<Queue.Item> r = new ArrayList<Queue.Item>();
|
||||
for( Queue.Item item : base) {
|
||||
Task t = item.task;
|
||||
if((t instanceof MavenModule && ((MavenModule)t).getParent()==this) || t ==this)
|
||||
r.add(item);
|
||||
|
||||
Reference in new issue
Block a user