[FELIX-3635] Unnecessary processing in DirectoryWatcher
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1378126 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
index f1bcb83..1a20f95 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
@@ -481,17 +481,20 @@
Collection uninstalledBundles = uninstall(deleted);
Collection updatedBundles = update(modified);
Collection installedBundles = install(created);
-
- Set toRefresh = new HashSet();
- toRefresh.addAll( uninstalledBundles );
- toRefresh.addAll(updatedBundles);
- toRefresh.addAll( installedBundles );
- findBundlesWithFragmentsToRefresh( toRefresh );
- findBundlesWithOptionalPackagesToRefresh( toRefresh );
- if (toRefresh.size() > 0)
+
+ if (!uninstalledBundles.isEmpty() || !updatedBundles.isEmpty() || !installedBundles.isEmpty())
{
- // Refresh if any bundle got uninstalled or updated.
- refresh((Bundle[]) toRefresh.toArray(new Bundle[toRefresh.size()]));
+ Set toRefresh = new HashSet();
+ toRefresh.addAll(uninstalledBundles);
+ toRefresh.addAll(updatedBundles);
+ toRefresh.addAll(installedBundles);
+ findBundlesWithFragmentsToRefresh(toRefresh);
+ findBundlesWithOptionalPackagesToRefresh(toRefresh);
+ if (toRefresh.size() > 0)
+ {
+ // Refresh if any bundle got uninstalled or updated.
+ refresh((Bundle[]) toRefresh.toArray(new Bundle[toRefresh.size()]));
+ }
}
if (startBundles)