felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r789942 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Date Tue, 30 Jun 2009 20:43:02 GMT
Author: rickhall
Date: Tue Jun 30 20:43:02 2009
New Revision: 789942

URL: http://svn.apache.org/viewvc?rev=789942&view=rev
Log:
Implement system bundle update. (FELIX-33)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=789942&r1=789941&r2=789942&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Tue Jun 30 20:43:02
2009
@@ -819,8 +819,46 @@
                 AdminPermission.EXECUTE));
         }
 
-        // TODO: FRAMEWORK - This is supposed to stop and then restart the framework.
-        throw new BundleException("System bundle update not implemented yet.");
+        // Spec says to close input stream first.
+        try
+        {
+            if (is != null) is.close();
+        }
+        catch (IOException ex)
+        {
+            m_logger.log(Logger.LOG_WARNING, "Exception closing input stream.", ex);
+        }
+
+        // Then to stop and restart the framework on a separate thread.
+        new Thread(new Runnable() {
+            public void run()
+            {
+                try
+                {
+                    stop();
+                }
+                catch (BundleException ex)
+                {
+                    m_logger.log(Logger.LOG_WARNING, "Exception stopping framework.", ex);
+                }
+                try
+                {
+                    waitForStop(0);
+                }
+                catch (InterruptedException ex)
+                {
+                    m_logger.log(Logger.LOG_WARNING, "Did not wait for framework to stop.",
ex);
+                }
+                try
+                {
+                    start();
+                }
+                catch (BundleException ex)
+                {
+                    m_logger.log(Logger.LOG_WARNING, "Exception restarting framework.", ex);
+                }
+            }
+        }).start();
     }
 
     public String toString()



Mime
View raw message