You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/04/11 11:02:02 UTC

[3/4] brooklyn-server git commit: Code review comments: gobble exceptions on stopping bundle.

Code review comments: gobble exceptions on stopping bundle.

Gobble exception to avoid possibility of causing problems stopping bundle.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/47421cba
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/47421cba
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/47421cba

Branch: refs/heads/master
Commit: 47421cbae6ed5fe0e7581ae5212fc2b31c60a5a9
Parents: 84720cf
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Thu Apr 7 09:49:30 2016 +0100
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Mon Apr 11 09:57:24 2016 +0100

----------------------------------------------------------------------
 .../core/catalog/internal/CatalogBomScanner.java     | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/47421cba/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
index 782055a..01d25f5 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
@@ -25,14 +25,11 @@ import org.apache.brooklyn.api.catalog.BrooklynCatalog;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.exceptions.CompoundRuntimeException;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.yaml.Yamls;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
-import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
 import org.osgi.util.tracker.BundleTracker;
 import org.slf4j.Logger;
@@ -124,7 +121,6 @@ public class CatalogBomScanner {
                 return;
             }
             LOG.debug("Unloading catalog BOM entries from {} {} {}", bundleIds(bundle));
-            List<Exception> exceptions = MutableList.of();
             final BrooklynCatalog catalog = getManagementContext().getCatalog();
             for (CatalogItem<?, ?> item : items) {
                 LOG.debug("Unloading {} {} from catalog", item.getSymbolicName(), item.getVersion());
@@ -132,18 +128,13 @@ public class CatalogBomScanner {
                 try {
                     catalog.deleteCatalogItem(item.getSymbolicName(), item.getVersion());
                 } catch (Exception e) {
-                    LOG.warn("Caught {} unloading {} {} from catalog", new String [] {
+                    // Gobble exception to avoid possibility of causing problems stopping bundle.
+                    LOG.warn("Caught {} unloading {} {} from catalog, ignoring", new String [] {
                         e.getMessage(), item.getSymbolicName(), item.getVersion()
                     });
-                    exceptions.add(e);
+                    Exceptions.propagateIfFatal(e);
                 }
             }
-
-            if (0 < exceptions.size()) {
-                throw new CompoundRuntimeException(
-                    "Caught exceptions unloading catalog from bundle " + bundle.getBundleId(),
-                    exceptions);
-            }
         }
 
         private Iterable<? extends CatalogItem<?, ?>> scanForCatalog(Bundle bundle) {