Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Bricon2013-09-12 04:47:19 -0400
committerFred Bricon2013-09-12 04:47:52 -0400
commitf08b5f8fcdd7ad2e3205e2aa6aee1f383aba3653 (patch)
tree6a704bd30e864c2aee2e4dae19f072525402d57c
parente295642d6f9fcc89e79889a98166f3eb824944f3 (diff)
downloadm2e-core-f08b5f8fcdd7ad2e3205e2aa6aee1f383aba3653.tar.gz
m2e-core-f08b5f8fcdd7ad2e3205e2aa6aee1f383aba3653.tar.xz
m2e-core-f08b5f8fcdd7ad2e3205e2aa6aee1f383aba3653.zip
386196 : properly monitor parallel downloads
Signed-off-by: Fred Bricon <fbricon@gmail.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/AbstractTransferListenerAdapter.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/AbstractTransferListenerAdapter.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/AbstractTransferListenerAdapter.java
index e94fdc43..46c525aa 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/AbstractTransferListenerAdapter.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/AbstractTransferListenerAdapter.java
@@ -11,6 +11,9 @@
package org.eclipse.m2e.core.internal.embedder;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,7 +39,8 @@ abstract class AbstractTransferListenerAdapter {
protected final IProgressMonitor monitor;
- protected long complete = 0;
+ //The same TransferListener monitors parallel downloads
+ protected Map<String, Long> progressMap = new ConcurrentHashMap<String, Long>();
private static final String[] units = {Messages.AbstractTransferListenerAdapter_byte,
Messages.AbstractTransferListenerAdapter_kb, Messages.AbstractTransferListenerAdapter_mb};
@@ -60,8 +64,6 @@ abstract class AbstractTransferListenerAdapter {
throw new OperationCanceledException(Messages.AbstractTransferListenerAdapter_cancelled);
}
- this.complete = 0;
-
if(artifactUrl != null) {
monitor.subTask(artifactUrl);
}
@@ -78,7 +80,10 @@ abstract class AbstractTransferListenerAdapter {
throw new OperationCanceledException(Messages.AbstractTransferListenerAdapter_cancelled);
}
+ Long downloadProgress = progressMap.get(artifactUrl);
+ long complete = downloadProgress == null ? 0L : downloadProgress.longValue();
complete += length;
+ progressMap.put(artifactUrl, complete);
StringBuffer sb = new StringBuffer();
@@ -102,11 +107,13 @@ abstract class AbstractTransferListenerAdapter {
// monitor.subTask("100% "+e.getWagon().getRepository()+"/"+e.getResource().getName());
monitor.subTask(""); //$NON-NLS-1$
+ progressMap.remove(artifactUrl);
}
protected void transferError(String artifactUrl, Exception exception) {
log.error(NLS.bind("Unable to download {0} : {1}", artifactUrl, exception));
monitor.subTask(NLS.bind(Messages.AbstractTransferListenerAdapter_subtask, artifactUrl));
+ progressMap.remove(artifactUrl);
}
}

Back to the top