Repository: karaf Updated Branches: refs/heads/master 3610b1dd8 -> 7d65db952
[KARAF-2888] Fix regression with FeaturesService bundle not being restarted after a refresh Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/7d65db95 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/7d65db95 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/7d65db95 Branch: refs/heads/master Commit: 7d65db95232aed033104eea425e56850acc93e7b Parents: 3610b1d Author: Guillaume Nodet <gno...@gmail.com> Authored: Fri Apr 25 18:18:26 2014 +0200 Committer: Guillaume Nodet <gno...@gmail.com> Committed: Fri Apr 25 18:18:26 2014 +0200 ---------------------------------------------------------------------- .../internal/service/FeaturesServiceImpl.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/7d65db95/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java ---------------------------------------------------------------------- diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java index 5d40440..5ed76a1 100644 --- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java +++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java @@ -1708,14 +1708,22 @@ public class FeaturesServiceImpl implements FeaturesService { protected List<Bundle> getBundlesToStart(Collection<Bundle> bundles) { // Restart the features service last, regardless of any other consideration // so that we don't end up with the service trying to do stuff before we're done - boolean restart = bundles.remove(bundle); + boolean restart = false; SortedMap<Integer, Set<Bundle>> bundlesPerStartLevel = new TreeMap<>(); for (Bundle bundle : bundles) { - int sl = bundle.adapt(BundleStartLevel.class).getStartLevel(); - addToMapSet(bundlesPerStartLevel, sl, bundle); + if (bundle == this.bundle) { + restart = true; + } else { + int sl = bundle.adapt(BundleStartLevel.class).getStartLevel(); + addToMapSet(bundlesPerStartLevel, sl, bundle); + } + } + if (bundlesPerStartLevel.isEmpty()) { + bundles = Collections.emptyList(); + } else { + bundles = bundlesPerStartLevel.remove(bundlesPerStartLevel.firstKey()); } - bundles = bundlesPerStartLevel.remove(bundlesPerStartLevel.firstKey()); // We hit FELIX-2949 if we don't use the correct order as Felix resolver isn't greedy. // In order to minimize that, we make sure we resolve the bundles in the order they