You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2017/10/19 08:47:08 UTC
svn commit: r1812605 -
/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
Author: gnodet
Date: Thu Oct 19 08:47:08 2017
New Revision: 1812605
URL: http://svn.apache.org/viewvc?rev=1812605&view=rev
Log:
[FELIX-4740] Bundles don't start if no BundleEvent fired after reaching start level
Modified:
felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
Modified: felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java?rev=1812605&r1=1812604&r2=1812605&view=diff
==============================================================================
--- felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java (original)
+++ felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java Thu Oct 19 08:47:08 2017
@@ -138,6 +138,7 @@ public class DirectoryWatcher extends Th
String fragmentScope;
String optionalScope;
boolean disableNio2;
+ int frameworkStartLevel;
// Map of all installed artifacts
final Map<File, Artifact> currentManagedArtifacts = new HashMap<File, Artifact>();
@@ -503,20 +504,25 @@ public class DirectoryWatcher extends Th
}
}
- if (startBundles && isStateChanged())
- {
- // Try to start all the bundles that are not persistently stopped
- startAllBundles();
-
- delayedStart.addAll(installedBundles);
- delayedStart.removeAll(uninstalledBundles);
- // Try to start newly installed bundles, or bundles which we missed on a previous round
- startBundles(delayedStart);
- consistentlyFailingBundles.clear();
- consistentlyFailingBundles.addAll(delayedStart);
+ if (startBundles) {
+ int startLevel = systemBundle.adapt(FrameworkStartLevel.class).getStartLevel();
+ boolean doStart = isStateChanged() || startLevel != frameworkStartLevel;
+ frameworkStartLevel = startLevel;
+ if (doStart)
+ {
+ // Try to start all the bundles that are not persistently stopped
+ startAllBundles();
+
+ delayedStart.addAll(installedBundles);
+ delayedStart.removeAll(uninstalledBundles);
+ // Try to start newly installed bundles, or bundles which we missed on a previous round
+ startBundles(delayedStart);
+ consistentlyFailingBundles.clear();
+ consistentlyFailingBundles.addAll(delayedStart);
- // set the state as unchanged to not reattempt starting failed bundles
- setStateChanged(false);
+ // set the state as unchanged to not reattempt starting failed bundles
+ setStateChanged(false);
+ }
}
}
@@ -1233,7 +1239,6 @@ public class DirectoryWatcher extends Th
*/
private boolean startBundle(Bundle bundle, boolean logFailures)
{
- FrameworkStartLevel startLevelSvc = systemBundle.adapt(FrameworkStartLevel.class);
// Fragments can never be started.
// Bundles can only be started transient when the start level of the framework is high
// enough. Persistent (i.e. non-transient) starts will simply make the framework start the
@@ -1241,7 +1246,7 @@ public class DirectoryWatcher extends Th
if (startBundles
&& bundle.getState() != Bundle.UNINSTALLED
&& !isFragment(bundle)
- && startLevelSvc.getStartLevel() >= bundle.adapt(BundleStartLevel.class).getStartLevel())
+ && frameworkStartLevel >= bundle.adapt(BundleStartLevel.class).getStartLevel())
{
try
{