You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2016/09/08 05:47:19 UTC
karaf-cellar git commit: [KARAF-4668] Update cluster bundle state
when bundle start fails
Repository: karaf-cellar
Updated Branches:
refs/heads/master 6c125c4fc -> f28e5d82c
[KARAF-4668] Update cluster bundle state when bundle start fails
Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/f28e5d82
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/f28e5d82
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/f28e5d82
Branch: refs/heads/master
Commit: f28e5d82cc85c74776e7b5d7a23c4fda048f0fba
Parents: 6c125c4
Author: Jean-Baptiste Onofr� <jb...@apache.org>
Authored: Thu Sep 8 07:46:46 2016 +0200
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Thu Sep 8 07:46:46 2016 +0200
----------------------------------------------------------------------
.../karaf/cellar/bundle/BundleEventHandler.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/f28e5d82/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
index 8c4a349..86b8654 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
+import java.util.Map;
/**
* The BundleEventHandler is responsible to process received cluster event for bundles.
@@ -91,8 +92,18 @@ public class BundleEventHandler extends BundleSupport implements EventHandler<Cl
if (!isInstalled(event.getLocation())) {
installBundleFromLocation(event.getLocation());
}
- startBundle(event.getSymbolicName(), event.getVersion());
- LOGGER.debug("CELLAR BUNDLE: starting {}/{}", event.getSymbolicName(), event.getVersion());
+ try {
+ startBundle(event.getSymbolicName(), event.getVersion());
+ LOGGER.debug("CELLAR BUNDLE: starting {}/{}", event.getSymbolicName(), event.getVersion());
+ } catch (Exception e) {
+ // start failed, update cluster state
+ Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + event.getSourceGroup().getName());
+ BundleState state = clusterBundles.get(event.getSymbolicName() + "/" + event.getVersion());
+ if (state != null) {
+ state.setStatus(Bundle.INSTALLED);
+ clusterBundles.put(event.getSymbolicName() + "/" + event.getVersion(), state);
+ }
+ }
} else if (event.getType() == Bundle.RESOLVED) {
stopBundle(event.getSymbolicName(), event.getVersion());
LOGGER.debug("CELLAR BUNDLE: stopping {}/{}", event.getSymbolicName(), event.getVersion());