Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2008-09-04 17:55:43 +0000
committerSimon Kaegi2008-09-04 17:55:43 +0000
commit7f0d4ecce061a1719e091e060645bb6408664e50 (patch)
treecc542394c4d9b604b6bc74d4cc863bdff48bafc8 /bundles/org.eclipse.equinox.p2.directorywatcher/src
parent98097b776984d5dda01a4ee522515baa4b470b07 (diff)
downloadrt.equinox.p2-7f0d4ecce061a1719e091e060645bb6408664e50.tar.gz
rt.equinox.p2-7f0d4ecce061a1719e091e060645bb6408664e50.tar.xz
rt.equinox.p2-7f0d4ecce061a1719e091e060645bb6408664e50.zip
Bug 246220 [reconciler] Removals not detected correctly
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.directorywatcher/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java24
1 files changed, 13 insertions, 11 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 3e68f10a6..e594b17e8 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
@@ -42,8 +42,9 @@ public class RepositoryListener extends DirectoryChangeListener {
private final CachingArtifactRepository artifactRepository;
// at any point in time currentFiles is the list of files/dirs that the watcher has seen and
// believes to be on disk.
- private Map currentFiles;
- private Collection filesToRemove;
+ private final Map currentFiles = new HashMap();
+ private final Collection polledSeenFiles = new HashSet();
+
private EntryAdvice advice = new EntryAdvice();
private PublisherInfo info;
private IPublisherResult iusToAdd;
@@ -135,8 +136,8 @@ public class RepositoryListener extends DirectoryChangeListener {
}
public boolean removed(File file) {
- filesToRemove.add(file);
- return true;
+ // the IUs and artifacts associated with this file will get removed in stopPoll
+ return currentFiles.containsKey(file);
}
private boolean process(File file, boolean isAddition) {
@@ -184,26 +185,27 @@ public class RepositoryListener extends DirectoryChangeListener {
}
public Long getSeenFile(File file) {
- return (Long) currentFiles.get(file);
+ Long lastSeen = (Long) currentFiles.get(file);
+ if (lastSeen != null)
+ polledSeenFiles.add(file);
+ return lastSeen;
}
public void startPoll() {
- filesToRemove = new HashSet();
iusToAdd = new PublisherResult();
iusToChange = new PublisherResult();
- // TODO investigate why we do this here? Suspect it is to clean up the currentFiles collection
- // for removed entries. This may be a performance opportunity
- currentFiles = new HashMap();
synchronizeCurrentFiles();
}
public void stopPoll() {
+ final Set filesToRemove = new HashSet(currentFiles.keySet());
+ filesToRemove.removeAll(polledSeenFiles);
+ polledSeenFiles.clear();
+
synchronizeMetadataRepository(filesToRemove);
synchronizeArtifactRepository(filesToRemove);
- filesToRemove.clear();
iusToAdd = null;
iusToChange = null;
- currentFiles = null;
}
/**

Back to the top