diff options
| author | Jayaprakash Arthanareeswaran | 2012-04-24 18:07:29 +0000 |
|---|---|---|
| committer | Jayaprakash Arthanareeswaran | 2012-04-25 15:57:11 +0000 |
| commit | e43c6ed09b10ae435241ad2d75fd39056b384df8 (patch) | |
| tree | b4c79a4f512c6cd7bd9ecc481b1b26e0fa61a548 | |
| parent | 0dafa4f2e2b928e46665a7d028b087f69145477e (diff) | |
| download | eclipse.jdt.core-e43c6ed09b10ae435241ad2d75fd39056b384df8.tar.gz eclipse.jdt.core-e43c6ed09b10ae435241ad2d75fd39056b384df8.tar.xz eclipse.jdt.core-e43c6ed09b10ae435241ad2d75fd39056b384df8.zip | |
master - Fix for bug 376724: ExternalFoldersManager still has
synchronization gaps
| -rw-r--r-- | org.eclipse.jdt.core/buildnotes_jdt-core.html | 4 | ||||
| -rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java | 20 |
2 files changed, 17 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index 6fa644b016..5a0f845814 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -52,7 +52,9 @@ Eclipse SDK 3.8.0 - %date% - 3.8.0 M7 <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=374129">374129</a> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=376724">376724</a> +ExternalFoldersManager still has synchronization gaps +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=374129">374129</a> more tests for bug 372011 <br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365710">365710</a> FUP of bug 363293: Fix the incorrect added resource close diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java index 9ad73c8bb1..6c28b8182e 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java @@ -51,13 +51,17 @@ public class ExternalFoldersManager { private Set pendingFolders; // subset of keys of 'folders', for which linked folders haven't been created yet. private int counter = 0; /* Singleton instance */ - private static ExternalFoldersManager MANAGER = new ExternalFoldersManager(); + private static ExternalFoldersManager MANAGER; private ExternalFoldersManager() { // Prevent instantiation + getFolders(); } - public static ExternalFoldersManager getExternalFoldersManager() { + public static synchronized ExternalFoldersManager getExternalFoldersManager() { + if (MANAGER == null) { + MANAGER = new ExternalFoldersManager(); + } return MANAGER; } @@ -123,8 +127,10 @@ public class ExternalFoldersManager { result = externalFoldersProject.getFolder(LINKED_FOLDER_NAME + this.counter++); } while (result.exists()); if (scheduleForCreation) { - if (this.pendingFolders == null) - this.pendingFolders = Collections.synchronizedSet(new HashSet()); + synchronized(this) { + if (this.pendingFolders == null) + this.pendingFolders = Collections.synchronizedSet(new HashSet()); + } this.pendingFolders.add(externalFolderPath); } knownFolders.put(externalFolderPath, result); @@ -136,7 +142,7 @@ public class ExternalFoldersManager { * @param externalPath to link to * @return true if the argument was found in the list of pending folders and could be removed from it. */ - public boolean removePendingFolder(Object externalPath) { + public synchronized boolean removePendingFolder(Object externalPath) { if (this.pendingFolders == null) return false; return this.pendingFolders.remove(externalPath); @@ -195,7 +201,9 @@ public class ExternalFoldersManager { } public void createPendingFolders(IProgressMonitor monitor) throws JavaModelException{ - if (this.pendingFolders == null || this.pendingFolders.isEmpty()) return; + synchronized (this) { + if (this.pendingFolders == null || this.pendingFolders.isEmpty()) return; + } IProject externalFoldersProject = null; try { |
