Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2010-09-03 13:47:23 -0400
committerDJ Houghton2010-09-03 13:47:23 -0400
commit56a021bc9a924cd8f6ab58167acf535e6d349d7c (patch)
tree4b8833e6deeba617531cac48b2ee350cd3156a9b /bundles/org.eclipse.equinox.p2.directorywatcher
parentf6f3c426eceeaeca757f807359972e80559bd912 (diff)
downloadrt.equinox.p2-56a021bc9a924cd8f6ab58167acf535e6d349d7c.tar.gz
rt.equinox.p2-56a021bc9a924cd8f6ab58167acf535e6d349d7c.tar.xz
rt.equinox.p2-56a021bc9a924cd8f6ab58167acf535e6d349d7c.zip
Bug 324353 - [query] Repository query takes a long time when deleting a lot of IUs (from dropins)
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.directorywatcher')
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
index 36302dd32..08a5d8fdc 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
@@ -213,10 +213,14 @@ public class RepositoryListener extends DirectoryChangeListener {
metadataRepository.removeInstallableUnits(changes);
// create a query that will identify all ius related to removed files.
- // It's safe to compare a String with a File since the auto coercion will
- // first convert the String into a File.
+ // We convert the java.io.File objects to Strings before doing the comparison
+ // because when we have large numbers of files, the performance is much better.
+ // See bug 324353.
+ Collection<String> paths = new HashSet<String>(removedFiles.size());
+ for (File file : removedFiles)
+ paths.add(file.getAbsolutePath());
IQuery<IInstallableUnit> removeQuery = QueryUtil.createMatchQuery( //
- "$1.exists(x | properties[$0] == x)", FILE_NAME, removedFiles); //$NON-NLS-1$
+ "$1.exists(x | properties[$0] == x)", FILE_NAME, paths); //$NON-NLS-1$
IQueryResult<IInstallableUnit> toRemove = metadataRepository.query(removeQuery, null);
metadataRepository.removeInstallableUnits(toRemove.toUnmodifiableSet());
}

Back to the top