Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java')
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java
index 2a88ad6c0..69fac24b9 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java
@@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -108,7 +109,10 @@ public abstract class AbstractDelegatingFactory implements IDelegatingFactory
*/
public final boolean removeFactoryDelegate(final IAdaptable delegate)
{
- return _delegates.remove(delegate);
+ synchronized(_delegates)
+ {
+ return _delegates.remove(delegate);
+ }
}
/**
@@ -137,4 +141,16 @@ public abstract class AbstractDelegatingFactory implements IDelegatingFactory
// if no found, delegate is not supported
return false;
}
+
+ /**
+ * @return an iterator to _delegates which is retrieved in a synchronized block to protect against
+ * access during sorting.
+ */
+ protected final Iterator<IAdaptable> getDelegatesIterator()
+ {
+ synchronized(_delegates)
+ {
+ return _delegates.iterator();
+ }
+ }
}

Back to the top