You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by da...@apache.org on 2016/04/01 16:49:46 UTC
svn commit: r1737404 -
/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
Author: davidb
Date: Fri Apr 1 14:49:45 2016
New Revision: 1737404
URL: http://svn.apache.org/viewvc?rev=1737404&view=rev
Log:
FELIX-4934 Only log failures for consistently failing bundles
Applying patch on behalf of Raymond Augé with many thanks.
This closes #23
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=1737404&r1=1737403&r2=1737404&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 Fri Apr 1 14:49:45 2016
@@ -149,6 +149,9 @@ public class DirectoryWatcher extends Th
// Represents installed artifacts which need to be started later because they failed to start
Set<Bundle> delayedStart = new HashSet<Bundle>();
+ // Represents consistently failing bundles
+ Set<Bundle> consistentlyFailingBundles = new HashSet<Bundle>();
+
// Represents artifacts that could not be installed
final Map<File, Artifact> installationFailures = new HashMap<File, Artifact>();
@@ -507,6 +510,8 @@ public class DirectoryWatcher extends Th
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);
@@ -1213,9 +1218,11 @@ public class DirectoryWatcher extends Th
*/
private void startBundles(Collection<Bundle> bundles)
{
+ // Check if this is the consistent set of bundles which failed previously.
+ boolean logFailures = bundles.equals(consistentlyFailingBundles);
for (Iterator<Bundle> b = bundles.iterator(); b.hasNext(); )
{
- if (startBundle(b.next()))
+ if (startBundle(b.next(), logFailures))
{
b.remove();
}
@@ -1227,7 +1234,7 @@ public class DirectoryWatcher extends Th
* @param bundle the bundle to start.
* @return whether the bundle was started.
*/
- private boolean startBundle(Bundle bundle)
+ private boolean startBundle(Bundle bundle, boolean logFailures)
{
FrameworkStartLevel startLevelSvc = systemBundle.adapt(FrameworkStartLevel.class);
// Fragments can never be started.
@@ -1250,7 +1257,10 @@ public class DirectoryWatcher extends Th
catch (BundleException e)
{
// Don't log this as an error, instead we start the bundle repeatedly.
- log(Logger.LOG_WARNING, "Error while starting bundle: " + bundle.getLocation(), e);
+ if (logFailures)
+ {
+ log(Logger.LOG_WARNING, "Error while starting bundle: " + bundle.getLocation(), e);
+ }
}
}
return false;