Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2017-11-27 17:21:49 +0000
committerAndrey Loskutov2017-11-28 17:03:59 +0000
commitbc60f3a25aef478e51956b6a0b704210fdcba66b (patch)
tree3c870e2b50816f741a9725c9c03a5da86560b4bf
parent13eb6669806171ab554d7a112e84deacfa14d6e9 (diff)
downloadeclipse.jdt.core-bc60f3a25aef478e51956b6a0b704210fdcba66b.tar.gz
eclipse.jdt.core-bc60f3a25aef478e51956b6a0b704210fdcba66b.tar.xz
eclipse.jdt.core-bc60f3a25aef478e51956b6a0b704210fdcba66b.zip
Bug 527819 - use right object for synchronization
Overall in the class except one place the access to pendingFolders is guarded by the lock on ExternalFoldersManager.this object. Fix this to avoid further issues. See bug 368152 and bug 376724 patches for previous attempts to make the code MT safe. Change-Id: I785fdc75babcadc7dcffee37fb94d28860ef4052 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java4
1 files changed, 2 insertions, 2 deletions
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 fb0087e33d..eb973de48e 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
@@ -152,7 +152,7 @@ public class ExternalFoldersManager {
synchronized (this) {
if (scheduleForCreation) {
if (this.pendingFolders == null)
- this.pendingFolders = Collections.synchronizedSet(new HashSet());
+ this.pendingFolders = new HashSet();
this.pendingFolders.add(externalFolderPath);
}
existing = knownFolders.get(externalFolderPath);
@@ -215,7 +215,7 @@ public class ExternalFoldersManager {
// To avoid race condition (from addFolder and removeFolder, load the map elements into an array and clear the map immediately.
// The createLinkFolder being in the synchronized block can cause a deadlock and hence keep it out of the synchronized block.
Object[] arrayOfFolders = null;
- synchronized (this.pendingFolders) {
+ synchronized (this) {
arrayOfFolders = this.pendingFolders.toArray();
this.pendingFolders.clear();
}

Back to the top