Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-08-18 12:09:04 -0400
committerPascal Rapicault2010-08-18 12:09:04 -0400
commitfef51192626d2570af041e80e0b93078d390b8d1 (patch)
tree6ba1a4b59ce45da4941b11da39f7bcff0d3ace14 /bundles/org.eclipse.equinox.p2.artifact.repository
parent25d4506a68edf084ad53e317101671103a570749 (diff)
downloadrt.equinox.p2-fef51192626d2570af041e80e0b93078d390b8d1.tar.gz
rt.equinox.p2-fef51192626d2570af041e80e0b93078d390b8d1.tar.xz
rt.equinox.p2-fef51192626d2570af041e80e0b93078d390b8d1.zip
Bug 313744 - SimpleArtifactRepository does not allow the user to limit the number of threads used for downloads
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index c07dc1061..465b29d0f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -724,14 +724,23 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
* Returns the maximum number of concurrent download threads.
*/
private int getMaximumThreads() {
+ int repoMaxThreads = DEFAULT_MAX_THREADS;
+ int userMaxThreads = DEFAULT_MAX_THREADS;
try {
String maxThreadString = getProperties().get(PROP_MAX_THREADS);
if (maxThreadString != null)
- return Math.max(1, Integer.parseInt(maxThreadString));
+ repoMaxThreads = Math.max(1, Integer.parseInt(maxThreadString));
} catch (NumberFormatException nfe) {
- // return default number of threads
+ // default number of threads
}
- return DEFAULT_MAX_THREADS;
+ try {
+ String maxThreadString = Activator.getContext().getProperty(PROP_MAX_THREADS);
+ if (maxThreadString != null)
+ userMaxThreads = Math.max(1, Integer.parseInt(maxThreadString));
+ } catch (NumberFormatException nfe) {
+ // default number of threads
+ }
+ return Math.min(repoMaxThreads, userMaxThreads);
}
public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException {

Back to the top