diff options
author | Ed Merks | 2019-09-27 08:00:49 +0000 |
---|---|---|
committer | Ed Merks | 2019-10-12 05:15:00 +0000 |
commit | acf3335419e20bba9e5ddf9541c8795f2eb50057 (patch) | |
tree | 3dd4e5da4af4b63092c0de3236d65e20852415db /bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact | |
parent | 97a4ce3c1961c36f59f1013296d5ad18d3be728c (diff) | |
download | rt.equinox.p2-acf3335419e20bba9e5ddf9541c8795f2eb50057.tar.gz rt.equinox.p2-acf3335419e20bba9e5ddf9541c8795f2eb50057.tar.xz rt.equinox.p2-acf3335419e20bba9e5ddf9541c8795f2eb50057.zip |
Bug 471861 - The "eclipse.p2.max.threads" property has no effect forI20191013-1800I20191012-1800
values greater than four
Update SimpleArtifactRepositoryTest.testMaximumThreads() to test for the
modified expected behavior. I.e., that the repo can specify a maximum
that must be respected, the user can specify a maximum that is respected
if the repo doesn't specify a lower maximum, and if the user doesn't
specify a maximum, it behaves the same way as if the user specified a
maximum of 4.
Change-Id: I64b80d04b982ef37e60cf07312084ffaaab7b05a
Signed-off-by: Ed Merks <ed.merks@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java | 20 |
1 files changed, 11 insertions, 9 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 6143ba749..992beed7d 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 @@ -955,24 +955,26 @@ 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; + int maxThreads = DEFAULT_MAX_THREADS; try { - String maxThreadString = getProperties().get(PROP_MAX_THREADS); + String maxThreadString = Activator.getContext().getProperty(PROP_MAX_THREADS); if (maxThreadString != null) - repoMaxThreads = Math.max(1, Integer.parseInt(maxThreadString)); + maxThreads = Math.max(1, Integer.parseInt(maxThreadString)); } catch (NumberFormatException nfe) { // default number of threads } try { - String maxThreadString = Activator.getContext().getProperty(PROP_MAX_THREADS); - if (maxThreadString != null) - userMaxThreads = Math.max(1, Integer.parseInt(maxThreadString)); + String maxThreadString = getProperties().get(PROP_MAX_THREADS); + if (maxThreadString != null) { + int repoMaxThreads = Math.max(1, Integer.parseInt(maxThreadString)); + maxThreads = Math.min(maxThreads, repoMaxThreads); + } } catch (NumberFormatException nfe) { - // default number of threads + // ignore repoMaxThreads } - return Math.min(repoMaxThreads, userMaxThreads); + return maxThreads; } @Override |