FELIX-600 Insert 2 seconds delay after install/update before refreshing packages
(if instructed to refresh packages)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@663947 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java
index 6b0c658..13c3036 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java
@@ -312,14 +312,7 @@
         public void run()
         {
             // wait some time for the request to settle
-            try
-            {
-                sleep( 500L );
-            }
-            catch ( InterruptedException ie )
-            {
-                // don't care
-            }
+            sleepSilently( 500L );
 
             // now deploy the resolved bundles
             InputStream bundleStream = null;
@@ -330,6 +323,9 @@
 
                 if ( refreshPackages )
                 {
+                    // wait for asynchronous bundle start tasks to finish
+                    sleepSilently( 2000L );
+
                     try
                     {
                         PackageAdmin pa = installAction.getPackageAdmin();
@@ -371,5 +367,18 @@
                 bundleFile.delete();
             }
         }
+
+
+        protected void sleepSilently( long msecs )
+        {
+            try
+            {
+                sleep( msecs );
+            }
+            catch ( InterruptedException ie )
+            {
+                // don't care
+            }
+        }
     }
 }