felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r740901 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: Felix.java PackageAdminImpl.java StartLevelImpl.java util/EventDispatcher.java
Date Wed, 04 Feb 2009 21:38:20 GMT
Author: rickhall
Date: Wed Feb  4 21:38:20 2009
New Revision: 740901

URL: http://svn.apache.org/viewvc?rev=740901&view=rev
Log:
Made sure thread run() methods are reasonably robust in the face of
exceptions; added some comments to explain the approach. (FELIX-681)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.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=740901&r1=740900&r2=740901&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 Wed Feb  4 21:38:20
2009
@@ -3699,7 +3699,7 @@
                 {
                     stopBundle(m_bundle, false);
                 }
-                catch (BundleException ex)
+                catch (Throwable ex)
                 {
                     fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex);
                 }
@@ -3728,7 +3728,7 @@
                     refreshBundle(m_bundle);
                 }
             }
-            catch (Exception ex)
+            catch (Throwable ex)
             {
                 fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex);
             }
@@ -3742,7 +3742,7 @@
                 {
                     startBundle(m_bundle, false);
                 }
-                catch (BundleException ex)
+                catch (Throwable ex)
                 {
                     fireFrameworkEvent(FrameworkEvent.ERROR, m_bundle, ex);
                 }

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java?rev=740901&r1=740900&r2=740901&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java Wed
Feb  4 21:38:20 2009
@@ -331,6 +331,9 @@
             }
 
             // Perform refresh.
+            // NOTE: We don't catch any exceptions here, because
+            // the invoked method shields us from exceptions by
+            // catching Throwables when its invokes callbacks.
             m_felix.refreshPackages(bundles);
 
             // Remove the first request since it is now completed.

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java?rev=740901&r1=740900&r2=740901&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/StartLevelImpl.java Wed
Feb  4 21:38:20 2009
@@ -36,14 +36,12 @@
     private static final int BUNDLE_IDX = 0;
     private static final int STARTLEVEL_IDX = 1;
 
-    private Logger m_logger = null;
-    private Felix m_felix = null;
+    private final Felix m_felix;
     private final List m_requestList = new ArrayList();
     private Thread m_thread = null;
 
-    public StartLevelImpl(Logger logger, Felix felix)
+    public StartLevelImpl(Felix felix)
     {
-        m_logger = logger;
         m_felix = felix;
         // Start a thread to perform asynchronous package refreshes.
         m_thread = new Thread(this, "FelixStartLevel");
@@ -135,7 +133,7 @@
             catch (InterruptedException ex)
             {
                 // Log it and ignore since it won't cause much of an issue.
-                m_logger.log(
+                m_felix.getLogger().log(
                     Logger.LOG_WARNING,
                     "Wait for start level change during shutdown interrupted.",
                     ex);
@@ -256,6 +254,9 @@
             // is to set the framework start level. If the request is
             // an Object array, then the request is to set the start
             // level for a bundle.
+            // NOTE: We don't catch any exceptions here, because
+            // the invoked methods shield us from exceptions by
+            // catching Throwables when they invoke callbacks.
             if (request instanceof Integer)
             {
                 // Set the new framework start level.

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java?rev=740901&r1=740900&r2=740901&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
Wed Feb  4 21:38:20 2009
@@ -868,6 +868,9 @@
             // Deliver event outside of synchronized block
             // so that we don't block other requests from being
             // queued during event processing.
+            // NOTE: We don't catch any exceptions here, because
+            // the invoked method shields us from exceptions by
+            // catching Throwables when it invokes callbacks.
             fireEventImmediately(req.m_logger, req.m_type, req.m_listeners, req.m_event);
 
             // Put dispatch request in cache.
@@ -893,4 +896,4 @@
         public Object[] m_listeners = null;
         public EventObject m_event = null;
     }
-}
+}
\ No newline at end of file



Mime
View raw message