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
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
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java1
3 files changed, 15 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;
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
index 892e062f8..f7edbbf67 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
@@ -72,6 +72,7 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository impl
try {
ExtensionLocationArtifactRepository repo = (ExtensionLocationArtifactRepository) new ExtensionLocationArtifactRepositoryFactory().load(getLocation(), null);
artifactRepository = repo.artifactRepository;
+ base = repo.base;
} catch (ProvisionException e) {
//unexpected
e.printStackTrace();
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
index c700035bd..b1bd34fce 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
@@ -72,6 +72,7 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
try {
ExtensionLocationMetadataRepository repo = (ExtensionLocationMetadataRepository) new ExtensionLocationMetadataRepositoryFactory().load(getLocation(), null);
metadataRepository = repo.metadataRepository;
+ base = repo.base;
} catch (ProvisionException e) {
//unexpected
e.printStackTrace();

Back to the top