Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2010-02-22 09:41:50 +0000
committerThomas Hallgren2010-02-22 09:41:50 +0000
commitfe5098e97528432f807151c743c89d4b1a1dd20d (patch)
tree926162673ca2d16d10c5a3c7c39b3449d153ce0d /bundles/org.eclipse.equinox.p2.garbagecollector
parent8aa5a700fd1df2f75541c1329747668a0eb1716e (diff)
downloadrt.equinox.p2-fe5098e97528432f807151c743c89d4b1a1dd20d.tar.gz
rt.equinox.p2-fe5098e97528432f807151c743c89d4b1a1dd20d.tar.xz
rt.equinox.p2-fe5098e97528432f807151c743c89d4b1a1dd20d.zip
302201 : Unify the two query approaches used in p2, step 4.
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.garbagecollector')
-rw-r--r--bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java
index 79dc0eaaf..53b2e2c23 100644
--- a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java
+++ b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java
@@ -13,8 +13,9 @@ package org.eclipse.equinox.internal.p2.garbagecollector;
import java.util.*;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.query.ExpressionContextQuery;
+import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
-import org.eclipse.equinox.p2.query.MatchQuery;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
/**
@@ -33,12 +34,8 @@ public class CoreGarbageCollector {
* in aRepository that are not mapped to by an IArtifactKey in markSet
*/
public synchronized void clean(IArtifactKey[] markSet, final IArtifactRepository aRepository) {
- final Set<IArtifactKey> set = new HashSet<IArtifactKey>(Arrays.asList(markSet));
- MatchQuery<IArtifactKey> query = new MatchQuery<IArtifactKey>() {
- public boolean isMatch(IArtifactKey candidate) {
- return !set.contains(candidate);
- }
- };
+ Set<IArtifactKey> set = new HashSet<IArtifactKey>(Arrays.asList(markSet));
+ IQuery<IArtifactKey> query = new ExpressionContextQuery<IArtifactKey>(IArtifactKey.class, "unique($0)", set); //$NON-NLS-1$
final IQueryResult<IArtifactKey> inactive = aRepository.query(query, null);
aRepository.executeBatch(new Runnable() {
public void run() {

Back to the top