Restart the framework if it was stopped due to a system bundle udpate
or refresh. (FELIX-3094)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1162848 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/main/src/main/java/org/apache/felix/main/Main.java b/main/src/main/java/org/apache/felix/main/Main.java
index f7a7525..ca8bb84 100644
--- a/main/src/main/java/org/apache/felix/main/Main.java
+++ b/main/src/main/java/org/apache/felix/main/Main.java
@@ -24,6 +24,7 @@
 import java.util.*;
 import org.apache.felix.framework.util.Util;
 import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.launch.Framework;
 import org.osgi.framework.launch.FrameworkFactory;
 
@@ -289,10 +290,15 @@
             // Use the system bundle context to process the auto-deploy
             // and auto-install/auto-start properties.
             AutoProcessor.process(configProps, m_fwk.getBundleContext());
-            // Start the framework.
-            m_fwk.start();
-            // Wait for framework to stop to exit the VM.
-            m_fwk.waitForStop(0);
+            FrameworkEvent event;
+            do
+            {
+                // Start the framework.
+                m_fwk.start();
+                // Wait for framework to stop to exit the VM.
+                event = m_fwk.waitForStop(0);
+            }
+            while (event.getType() == FrameworkEvent.STOPPED_UPDATE);
             System.exit(0);
         }
         catch (Exception ex)