Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2012-09-17 18:50:59 +0000
committerJohn Arthorne2012-09-17 18:50:59 +0000
commitd9b15e4ba3c5f815546e92c0c97cd1adfcec7d9d (patch)
treede7195bd23aa91bdb6826d2d671c01cbb76da5f3 /bundles/org.eclipse.equinox.preferences
parent9b76e9a22060fe379db8f75d994dd05282e23f8a (diff)
downloadrt.equinox.bundles-d9b15e4ba3c5f815546e92c0c97cd1adfcec7d9d.tar.gz
rt.equinox.bundles-d9b15e4ba3c5f815546e92c0c97cd1adfcec7d9d.tar.xz
rt.equinox.bundles-d9b15e4ba3c5f815546e92c0c97cd1adfcec7d9d.zip
Bug 389630 - Deadlock in EclipsePreferencesv20120917-185059
Diffstat (limited to 'bundles/org.eclipse.equinox.preferences')
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index 1e98e4ed5..f69dcfbd1 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -424,17 +424,25 @@ public class EclipsePreferences implements IEclipsePreferences, IScope {
* @see org.osgi.service.prefs.Preferences#flush()
*/
public void flush() throws BackingStoreException {
+ IEclipsePreferences toFlush = null;
synchronized (childAndPropertyLock) {
- internalFlush();
+ toFlush = internalFlush();
}
+ //if we aren't at the right level, then flush the appropriate node
+ if (toFlush != null)
+ toFlush.flush();
PreferencesService.getDefault().shareStrings();
}
/*
* Do the real flushing in a non-synchronized internal method so sub-classes
* (mainly ProjectPreferences and ProfilePreferences) don't cause deadlocks.
+ *
+ * If this node is not responsible for persistence (a load level), then this method
+ * returns the node that should be flushed. Returns null if this method performed
+ * the flush.
*/
- protected void internalFlush() throws BackingStoreException {
+ protected IEclipsePreferences internalFlush() throws BackingStoreException {
// illegal state if this node has been removed
checkRemoved();
@@ -445,19 +453,17 @@ public class EclipsePreferences implements IEclipsePreferences, IScope {
String[] childrenNames = childrenNames();
for (int i = 0; i < childrenNames.length; i++)
node(childrenNames[i]).flush();
- return;
+ return null;
}
// a parent is the load level for this node
- if (this != loadLevel) {
- loadLevel.flush();
- return;
- }
+ if (this != loadLevel)
+ return loadLevel;
// this node is a load level
// any work to do?
if (!dirty)
- return;
+ return null;
//remove dirty bit before saving, to ensure that concurrent
//changes during save mark the store as dirty
dirty = false;
@@ -468,6 +474,7 @@ public class EclipsePreferences implements IEclipsePreferences, IScope {
dirty = true;
throw e;
}
+ return null;
}
/*

Back to the top