Fixed a race condition which allowed two threads to start taking items from the serial queue.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1486778 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/SerialExecutor.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/SerialExecutor.java
index 43c0ec5..c8a245b 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/SerialExecutor.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/SerialExecutor.java
@@ -31,6 +31,7 @@
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public final class SerialExecutor {
+	private static final Runnable DUMMY_RUNNABLE = new Runnable() { public void run() {}; };
     private final LinkedList m_workQueue = new LinkedList();
     private Runnable m_active;
     
@@ -63,6 +64,10 @@
     	Runnable active;
     	synchronized (this) {
     		active = m_active;
+    		// for now just put some non-null value in there so we can never
+    		// get a race condition when two threads enter this section after
+    		// one another (causing sheduleNext() to be invoked twice below)
+    		m_active = DUMMY_RUNNABLE;
     	}
     	if (active == null) {
     		scheduleNext();