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 150051 Details for
Bug 274025
[publisher] p2 metadata generator does not scale
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
org.eclipse.equinox.p2.artifactrepository.patch
clipboard.txt (text/plain), 11.55 KB, created by
Ian Bull
on 2009-10-20 23:31:09 EDT
(
hide
)
Description:
org.eclipse.equinox.p2.artifactrepository.patch
Filename:
MIME Type:
Creator:
Ian Bull
Created:
2009-10-20 23:31:09 EDT
Size:
11.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.artifact.repository >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java,v >retrieving revision 1.18 >diff -u -r1.18 CompositeArtifactRepository.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java 13 Apr 2009 21:15:04 -0000 1.18 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java 21 Oct 2009 03:32:40 -0000 >@@ -43,6 +43,7 @@ > private List childrenURIs = new ArrayList(); > // keep a list of the repositories that we have successfully loaded > private List loadedRepos = new ArrayList(); >+ private boolean disableSave = false; > > /** > * Create a Composite repository in memory. >@@ -382,6 +383,9 @@ > } > > private void save() { >+ if (disableSave) >+ return; >+ > if (!isModifiable()) > return; > boolean compress = "true".equalsIgnoreCase((String) properties.get(PROP_COMPRESSED)); //$NON-NLS-1$ >@@ -517,4 +521,24 @@ > return good; > } > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository#executeBatch(java.lang.Runnable) >+ */ >+ public void executeBatch(Runnable process) { >+ synchronized (this) { >+ try { >+ disableSave = true; >+ process.run(); >+ } finally { >+ disableSave = false; >+ try { >+ save(); >+ } catch (Exception e) { >+ // I guess we should log this >+ } >+ } >+ } >+ >+ } > } >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/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.82 >diff -u -r1.82 SimpleArtifactRepository.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java 7 Jul 2009 15:45:00 -0000 1.82 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java 21 Oct 2009 03:32:40 -0000 >@@ -211,6 +211,8 @@ > > private MirrorSelector mirrors; > >+ private boolean disableSave = false; >+ > static void delete(File toDelete) { > if (toDelete.isDirectory()) { > File[] children = toDelete.listFiles(); >@@ -872,12 +874,13 @@ > return result; > } > >- public void save() { >+ private void save() { > boolean compress = "true".equalsIgnoreCase((String) properties.get(PROP_COMPRESSED)); //$NON-NLS-1$ >- save(compress); >+ if (!disableSave) >+ save(compress); > } > >- public void save(boolean compress) { >+ private void save(boolean compress) { > assertModifiable(); > OutputStream os = null; > try { >@@ -949,4 +952,24 @@ > public String toString() { > return location.toString(); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository#executeBatch(java.lang.Runnable) >+ */ >+ public void executeBatch(Runnable process) { >+ synchronized (this) { >+ try { >+ disableSave = true; >+ process.run(); >+ } finally { >+ disableSave = false; >+ try { >+ save(); >+ } catch (Exception e) { >+ // I guess we should log this >+ } >+ } >+ } >+ >+ } > } >Index: src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java,v >retrieving revision 1.9 >diff -u -r1.9 IArtifactRepository.java >--- src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java 29 Apr 2009 16:18:37 -0000 1.9 >+++ src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java 21 Oct 2009 03:32:40 -0000 >@@ -130,4 +130,10 @@ > */ > public void removeDescriptor(IArtifactKey key); > >+ /** >+ * >+ * @param process >+ */ >+ public void executeBatch(Runnable process); >+ > } >Index: src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java,v >retrieving revision 1.9 >diff -u -r1.9 AbstractArtifactRepository.java >--- src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java 29 Apr 2009 16:18:37 -0000 1.9 >+++ src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java 21 Oct 2009 03:32:40 -0000 >@@ -75,4 +75,8 @@ > return (this.getLocation().toString().hashCode()) * 87; > } > >+ public void executeBatch(Runnable process) { >+ process.run(); >+ } >+ > } >#P org.eclipse.equinox.p2.publisher >Index: src/org/eclipse/equinox/p2/publisher/Publisher.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java,v >retrieving revision 1.12 >diff -u -r1.12 Publisher.java >--- src/org/eclipse/equinox/p2/publisher/Publisher.java 25 May 2009 21:35:52 -0000 1.12 >+++ src/org/eclipse/equinox/p2/publisher/Publisher.java 21 Oct 2009 03:32:41 -0000 >@@ -157,6 +157,38 @@ > this.results = results; > } > >+ class ArtifactProcess implements Runnable { >+ >+ private final IPublisherAction[] actions; >+ private final IPublisherInfo info; >+ private final IProgressMonitor monitor; >+ private IStatus result = null; >+ >+ public ArtifactProcess(IPublisherAction[] actions, IPublisherInfo info, IProgressMonitor monitor) { >+ this.monitor = monitor; >+ this.info = info; >+ this.actions = actions; >+ } >+ >+ public void run() { >+ MultiStatus finalStatus = new MultiStatus("this", 0, "publishing result", null); //$NON-NLS-1$//$NON-NLS-2$ >+ for (int i = 0; i < actions.length; i++) { >+ if (monitor.isCanceled()) { >+ result = Status.CANCEL_STATUS; >+ return; >+ } >+ IStatus status = actions[i].perform(info, results, monitor); >+ finalStatus.merge(status); >+ monitor.worked(1); >+ } >+ result = finalStatus; >+ } >+ >+ public IStatus getStatus() { >+ return result; >+ } >+ } >+ > public IStatus publish(IPublisherAction[] actions, IProgressMonitor monitor) { > if (monitor == null) > monitor = new NullProgressMonitor(); >@@ -164,15 +196,15 @@ > if (Tracing.DEBUG_PUBLISHING) > Tracing.debug("Invoking publisher"); //$NON-NLS-1$ > try { >- // run all the actions >- MultiStatus finalStatus = new MultiStatus("this", 0, "publishing result", null); //$NON-NLS-1$//$NON-NLS-2$ >- for (int i = 0; i < actions.length; i++) { >- if (sub.isCanceled()) >- return Status.CANCEL_STATUS; >- IStatus status = actions[i].perform(info, results, monitor); >- finalStatus.merge(status); >- sub.worked(1); >+ ArtifactProcess artifactProcess = new ArtifactProcess(actions, info, sub); >+ >+ if (info.getArtifactRepository() != null) { >+ info.getArtifactRepository().executeBatch(artifactProcess); >+ } else { >+ artifactProcess.run(); > } >+ IStatus finalStatus = artifactProcess.getStatus(); >+ > if (Tracing.DEBUG_PUBLISHING) > Tracing.debug("Publishing complete. Result=" + finalStatus); //$NON-NLS-1$ > if (!finalStatus.isOK()) >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractWrappedArtifactRepository.java >--- src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java 20 May 2009 04:31:09 -0000 1.2 >+++ src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java 21 Oct 2009 03:32:42 -0000 >@@ -130,4 +130,8 @@ > public Object getAdapter(Class adapter) { > return delegate.getAdapter(adapter); > } >+ >+ public void executeBatch(Runnable process) { >+ delegate.executeBatch(process); >+ } > } >Index: src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java,v >retrieving revision 1.10 >diff -u -r1.10 MirrorRequestTest.java >--- src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java 8 Oct 2009 13:32:16 -0000 1.10 >+++ src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java 21 Oct 2009 03:32:42 -0000 >@@ -10,8 +10,6 @@ > *******************************************************************************/ > package org.eclipse.equinox.p2.tests.artifact.repository; > >-import org.eclipse.equinox.internal.provisional.p2.metadata.Version; >- > import java.io.*; > import java.lang.reflect.Field; > import java.net.URI; >@@ -27,6 +25,7 @@ > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*; > import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; > import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey; >+import org.eclipse.equinox.internal.provisional.p2.metadata.Version; > import org.eclipse.equinox.internal.provisional.p2.repository.IRepository; > import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository; > import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository; >@@ -304,6 +303,13 @@ > public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { > return delegate.getRawArtifact(descriptor, destination, monitor); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository#executeBatch(java.lang.Runnable) >+ */ >+ public void executeBatch(Runnable process) { >+ process.run(); >+ } > } > > /* >Index: src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java,v >retrieving revision 1.5 >diff -u -r1.5 TestArtifactRepository.java >--- src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java 25 May 2009 21:48:59 -0000 1.5 >+++ src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java 21 Oct 2009 03:32:42 -0000 >@@ -25,7 +25,7 @@ > import org.eclipse.equinox.p2.tests.TestActivator; > import org.eclipse.osgi.util.NLS; > >-@SuppressWarnings( {"restriction", "unchecked"}) >+@SuppressWarnings({"restriction", "unchecked"}) > public class TestArtifactRepository implements IArtifactRepository { > private static String provider = null; > private HashMap/*<IArtifactDescriptor, byte[]>*/repo; >@@ -292,4 +292,8 @@ > public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { > return getArtifact(descriptor, destination, monitor); > } >+ >+ public void executeBatch(Runnable process) { >+ process.run(); >+ } > } >\ No newline at end of file
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 274025
:
135911
|
135912
|
137885
|
137943
|
137945
|
150051
|
150052
|
150882
|
150883
|
157998
|
158248