From 9d2adbc430bb08f059a87482f888fafbb164490b Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sat, 20 Jan 2007 04:58:02 +0000 Subject: [PATCH] expanding the use of CopyOnWriteMap. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1818 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Hudson.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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); } -- GitLab