[283634] ProjectResourceSetImpl getResources() cause deadlock with call to SynchronizedResourcesEList
diff --git a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
index 863afe1..c48a64c 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
+++ b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
@@ -14,6 +14,7 @@
 <h2>org.eclipse.wst.common_core.feature</h2>
 
 <p>Bug <a href='https://bugs.eclipse.org/279175'>279175</a>. An internal error occurred during: "Validation TestEJB".</p>
+<p>Bug <a href='https://bugs.eclipse.org/283634'>283634</a>. ProjectResourceSetImpl getResources() cause deadlock with call to SynchronizedResourcesEList</p>
 <p>Bug <a href='https://bugs.eclipse.org/284041'>284041</a>. EOF in Validation Framework</p>
 <p>Bug <a href='https://bugs.eclipse.org/285071'>285071</a>. ComponentResolver does not resolve absolute references to the context root</p>
 </body>
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.properties b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
index 37e6a6e..d113e3e 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
@@ -28,6 +28,7 @@
 Contains fixes described in the following bugillia(s):\n\
 \n\
 Bug https://bugs.eclipse.org/279175 An internal error occurred during: "Validation TestEJB".\n\
+Bug https://bugs.eclipse.org/283634 ProjectResourceSetImpl getResources() cause deadlock with call to SynchronizedResourcesEList\n\
 Bug https://bugs.eclipse.org/284041 EOF in Validation Framework\n\
 Bug https://bugs.eclipse.org/285071 ComponentResolver does not resolve absolute references to the context root\n\
 \n\
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.xml b/features/org.eclipse.wst.common_core.feature.patch/feature.xml
index 5459742..c717f02 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.xml
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.xml
@@ -35,4 +35,11 @@
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.eclipse.jem.util"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>
diff --git a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
index 9e05ebc..3609c55 100644
--- a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jem.util; singleton:=true
-Bundle-Version: 2.0.101.qualifier
+Bundle-Version: 2.0.102.qualifier
 Bundle-Activator: org.eclipse.jem.util.plugin.JEMUtilPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
index d6473fc..7ad24b3 100644
--- a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
+++ b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
@@ -10,7 +10,7 @@
  *******************************************************************************/
 /*
  *  $$RCSfile: ProjectResourceSetImpl.java,v $$
- *  $$Revision: 1.21.2.1 $$  $$Date: 2009/05/14 00:17:56 $$ 
+ *  $$Revision: 1.21.2.1.2.1 $$  $$Date: 2009/08/06 22:48:54 $$ 
  */
 package org.eclipse.jem.internal.util.emf.workbench;
 
@@ -20,6 +20,8 @@
 import org.eclipse.core.resources.*;
 import org.eclipse.core.runtime.*;
 import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.impl.NotificationImpl;
 import org.eclipse.emf.common.util.EList;
@@ -50,197 +52,290 @@
 		 * 
 		 */
 		private static final long serialVersionUID = 1L;
-		private final Object lock = new Object();
+		private final ILock lock = Job.getJobManager().newLock();
 
 		public void move(int newPosition, E object) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				super.move(newPosition, object);
+			} finally {
+				lock.release();
 			}
-
 		}
 
 		public E move(int newPosition, int oldPosition) {
 
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.move(newPosition, oldPosition);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean add(E o) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.add(o);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public void add(int index, E element) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				super.add(index, element);
+			} finally {
+				lock.release();
 			}
-
 		}
 
 		public boolean addAll(Collection<? extends E> c) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.addAll(c);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean addAll(int index, Collection<? extends E> c) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.addAll(index, c);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public void clear() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				super.clear();
+			} finally {
+				lock.release();
 			}
-
 		}
 
 		public boolean contains(Object o) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.contains(o);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean containsAll(Collection<?> c) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.containsAll(c);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean equals(Object o) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.equals(o);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public E get(int index) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.get(index);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public int hashCode() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.hashCode();
+			} finally {
+				lock.release();
 			}
 		}
 
 		public int indexOf(Object o) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.indexOf(o);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean isEmpty() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.isEmpty();
+			} finally {
+				lock.release();
 			}
 		}
 
 		public Iterator<E> iterator() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.iterator();
+			} finally {
+				lock.release();
 			}
 		}
 
 		public int lastIndexOf(Object o) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.lastIndexOf(o);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public ListIterator<E> listIterator() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.listIterator();
+			} finally {
+				lock.release();
 			}
 		}
 
 		public ListIterator<E> listIterator(int index) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.listIterator(index);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean remove(Object o) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.remove(o);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public E remove(int index) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.remove(index);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean removeAll(Collection<?> c) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.removeAll(c);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public boolean retainAll(Collection<?> c) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.retainAll(c);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public E set(int index, E element) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.set(index, element);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public int size() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.size();
+			} finally {
+				lock.release();
 			}
 		}
 
 		public List<E> subList(int fromIndex, int toIndex) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.subList(fromIndex, toIndex);
+			} finally {
+				lock.release();
 			}
 		}
 
 		public Object[] toArray() {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.toArray();
+			} finally {
+				lock.release();
 			}
 		}
 
 		public <T> T[] toArray(T[] a) {
 			
-			synchronized(lock) {
+			try {
+				lock.acquire();
 				return super.toArray(a);
+			} finally {
+				lock.release();
+			}
+		}
+
+		// release lock during notifications
+		protected void dispatchNotification(Notification notification) {
+
+			int lockDepth;
+			lockDepth = lock.getDepth();
+			try {
+				for(int i=0; i<lockDepth; i++)
+                    lock.release();
+				super.dispatchNotification(notification);
+			} finally {
+				for(int i=0; i<lockDepth; i++)
+                    lock.acquire();  // Re-acquire lock after notify
 			}
 		}