diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 4e05b09ee4..79e2bad334 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -31,7 +31,7 @@ import hudson.triggers.Triggers; import hudson.util.CopyOnWriteList; import hudson.util.FormFieldValidator; import hudson.util.XStream2; -import hudson.util.CopyOnWriteHashMap; +import hudson.util.CopyOnWriteMap; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; @@ -83,7 +83,7 @@ public final class Hudson extends View implements ItemGroup, Node /** * {@link Computer}s in this Hudson system. Read-only. */ - private transient final Map computers = new CopyOnWriteHashMap(); + private transient final Map computers = new CopyOnWriteMap.Hash(); /** * Number of executors of the master node. @@ -108,7 +108,7 @@ public final class Hudson extends View implements ItemGroup, Node /** * All {@link Item}s keyed by their {@link Item#getName() name}s. */ - /*package*/ transient final Map items = new TreeMap(); + /*package*/ transient final Map items = new CopyOnWriteMap.Tree(); /** * The sole instance. @@ -361,25 +361,25 @@ public final class Hudson extends View implements ItemGroup, Node /** * Gets the snapshot of all the jobs. */ - public synchronized List getJobs() { + public List getJobs() { return Util.createSubList(items.values(),Job.class); } - public synchronized List getItems() { + public List getItems() { return new ArrayList(items.values()); } /** * Gets the snapshot of all the projects. */ - public synchronized List getProjects() { + public List getProjects() { return Util.createSubList(items.values(),Project.class); } /** * Gets the names of all the {@link Job}s. */ - public synchronized Collection getJobNames() { + public Collection getJobNames() { List names = new ArrayList(); for (Item j : items.values()) { if (j instanceof Job) @@ -582,7 +582,7 @@ public final class Hudson extends View implements ItemGroup, Node * @return null * if such a project doesn't exist. */ - public synchronized Job getJob(String name) { + public Job getJob(String name) { TopLevelItem item = items.get(name); if(item instanceof Job) return (Job)item; @@ -593,7 +593,7 @@ public final class Hudson extends View implements ItemGroup, Node /** * Gets the {@link TopLevelItem} of the given name. */ - public synchronized TopLevelItem getItem(String name) { + public TopLevelItem getItem(String name) { return items.get(name); }