Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 107018 Details for
Bug 239890
RepositoryLister.synchronizeArtifactRepository is slow in large installs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
239890.txt (text/plain), 5.31 KB, created by
Simon Kaegi
on 2008-07-09 17:52:26 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Simon Kaegi
Created:
2008-07-09 17:52:26 EDT
Size:
5.31 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.artifact.repository >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java,v >retrieving revision 1.60 >diff -u -r1.60 SimpleArtifactRepository.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java 9 Jun 2008 12:48:33 -0000 1.60 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java 9 Jul 2008 21:51:03 -0000 >@@ -187,6 +187,7 @@ > static final private Integer REPOSITORY_VERSION = new Integer(1); > private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$ > protected Set artifactDescriptors = new HashSet(); >+ protected Map artifactMap = new HashMap(); > private transient BlobStore blobStore; > transient private Mapper mapper = new Mapper(); > >@@ -255,6 +256,29 @@ > super(name, type, version, null, description, provider, properties); > this.artifactDescriptors.addAll(artifacts); > this.mappingRules = mappingRules; >+ for (Iterator it = artifactDescriptors.iterator(); it.hasNext();) >+ mapDescriptor((IArtifactDescriptor) it.next()); >+ } >+ >+ private void mapDescriptor(IArtifactDescriptor descriptor) { >+ IArtifactKey key = descriptor.getArtifactKey(); >+ Collection descriptors = (Collection) artifactMap.get(key); >+ if (descriptors == null) { >+ descriptors = new ArrayList(); >+ artifactMap.put(key, descriptors); >+ } >+ descriptors.add(descriptor); >+ } >+ >+ private void unmapDescriptor(IArtifactDescriptor descriptor) { >+ IArtifactKey key = descriptor.getArtifactKey(); >+ Collection descriptors = (Collection) artifactMap.get(key); >+ if (descriptors == null) >+ return; >+ >+ descriptors.remove(descriptor); >+ if (descriptors.isEmpty()) >+ artifactMap.remove(key); > } > > public SimpleArtifactRepository(String repositoryName, URL location, Map properties) { >@@ -282,6 +306,7 @@ > // TODO: here we may want to ensure that the artifact has not been added concurrently > ((ArtifactDescriptor) toAdd).setRepository(this); > artifactDescriptors.add(toAdd); >+ mapDescriptor(toAdd); > save(); > } > >@@ -290,6 +315,7 @@ > for (int i = 0; i < descriptors.length; i++) { > ((ArtifactDescriptor) descriptors[i]).setRepository(this); > artifactDescriptors.add(descriptors[i]); >+ mapDescriptor(descriptors[i]); > } > save(); > } >@@ -347,12 +373,7 @@ > } > > public synchronized boolean contains(IArtifactKey key) { >- for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) { >- IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next(); >- if (descriptor.getArtifactKey().equals(key)) >- return true; >- } >- return false; >+ return artifactMap.containsKey(key); > } > > public synchronized String createLocation(ArtifactDescriptor descriptor) { >@@ -393,7 +414,11 @@ > if (file.exists()) > return false; > } >- return artifactDescriptors.remove(descriptor); >+ boolean result = artifactDescriptors.remove(descriptor); >+ if (result) >+ unmapDescriptor(descriptor); >+ >+ return result; > } > > protected IStatus downloadArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { >@@ -491,12 +516,10 @@ > } > > public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { >- ArrayList result = new ArrayList(); >- for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) { >- IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next(); >- if (descriptor.getArtifactKey().equals(key)) >- result.add(descriptor); >- } >+ Collection result = (Collection) artifactMap.get(key); >+ if (result == null) >+ return new IArtifactDescriptor[0]; >+ > return (IArtifactDescriptor[]) result.toArray(new IArtifactDescriptor[result.size()]); > } > >@@ -516,10 +539,7 @@ > > public synchronized IArtifactKey[] getArtifactKeys() { > // there may be more descriptors than keys to collect up the unique keys >- HashSet result = new HashSet(artifactDescriptors.size()); >- for (Iterator it = artifactDescriptors.iterator(); it.hasNext();) >- result.add(((IArtifactDescriptor) it.next()).getArtifactKey()); >- return (IArtifactKey[]) result.toArray(new IArtifactKey[result.size()]); >+ return (IArtifactKey[]) artifactMap.keySet().toArray(new IArtifactKey[artifactMap.keySet().size()]); > } > > public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { >@@ -564,7 +584,11 @@ > } > > public synchronized IArtifactDescriptor getCompleteArtifactDescriptor(IArtifactKey key) { >- for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) { >+ Collection descriptors = (Collection) artifactMap.get(key); >+ if (descriptors == null) >+ return null; >+ >+ for (Iterator iterator = descriptors.iterator(); iterator.hasNext();) { > IArtifactDescriptor desc = (IArtifactDescriptor) iterator.next(); > // look for a descriptor that matches the key and is "complete" > if (desc.getArtifactKey().equals(key) && desc.getProcessingSteps().length == 0)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 239890
: 107018