Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2011-02-04 15:32:26 -0500
committerDJ Houghton2011-02-04 15:32:26 -0500
commita42e7400572fbce148e9474109e0b8368e645556 (patch)
treeb90c478daa3f698941608f3e74a25cb76543d967 /bundles/org.eclipse.equinox.p2.artifact.repository
parent9220f1e487dc117a5bc4bebec0d689ee8b71e75d (diff)
downloadrt.equinox.p2-a42e7400572fbce148e9474109e0b8368e645556.tar.gz
rt.equinox.p2-a42e7400572fbce148e9474109e0b8368e645556.tar.xz
rt.equinox.p2-a42e7400572fbce148e9474109e0b8368e645556.zip
Bug 316916 - [repository] loading children of a composite repo is not covered by progress monitors
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/ArtifactRepositoryManager.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java9
3 files changed, 21 insertions, 16 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
index 5b74e16f4..e75e6b40e 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -66,7 +66,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
if (factory == null)
return null;
factory.setAgent(agent);
- return factory.load(location, flags, monitor.newChild(10));
+ return factory.load(location, flags, monitor);
}
protected String getBundleId() {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
index 516aeab1f..1b0d770a3 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -83,11 +83,12 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* This is only called by the parser when loading a repository.
*/
- CompositeArtifactRepository(IArtifactRepositoryManager manager, CompositeRepositoryState state) {
+ CompositeArtifactRepository(IArtifactRepositoryManager manager, CompositeRepositoryState state, IProgressMonitor monitor) {
super(manager.getAgent(), state.getName(), state.getType(), state.getVersion(), state.getLocation(), state.getDescription(), state.getProvider(), state.getProperties());
this.manager = manager;
- for (int i = 0; i < state.getChildren().length; i++)
- addChild(state.getChildren()[i], false);
+ SubMonitor sub = SubMonitor.convert(monitor, 100 * state.getChildren().length);
+ for (URI child : state.getChildren())
+ addChild(child, false, sub.newChild(100));
}
/**
@@ -143,18 +144,21 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
public void addChild(URI childURI) {
- addChild(childURI, true);
+ addChild(childURI, true, null);
}
- private void addChild(URI childURI, boolean save) {
+ private void addChild(URI childURI, boolean save, IProgressMonitor monitor) {
+ SubMonitor sub = SubMonitor.convert(monitor);
URI absolute = URIUtil.makeAbsolute(childURI, getLocation());
- if (childrenURIs.contains(childURI) || childrenURIs.contains(absolute))
+ if (childrenURIs.contains(childURI) || childrenURIs.contains(absolute)) {
+ sub.done();
return;
+ }
childrenURIs.add(childURI);
if (save)
save();
try {
- IArtifactRepository repo = load(childURI);
+ IArtifactRepository repo = load(childURI, sub);
loadedRepos.add(new ChildInfo(repo));
} catch (ProvisionException e) {
LogHelper.log(e);
@@ -445,11 +449,11 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
}
- private IArtifactRepository load(URI repoURI) throws ProvisionException {
+ private IArtifactRepository load(URI repoURI, IProgressMonitor monitor) throws ProvisionException {
// make sure we are dealing with an absolute location
repoURI = URIUtil.makeAbsolute(repoURI, getLocation());
boolean loaded = getManager().contains(repoURI);
- IArtifactRepository repo = getManager().loadRepository(repoURI, null);
+ IArtifactRepository repo = getManager().loadRepository(repoURI, monitor);
if (!loaded) {
//set enabled to false so repositories do not get polled twice
getManager().setEnabled(repoURI, false);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
index 180ed0137..78b8be27f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -88,7 +88,7 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
if (!PROTOCOL_FILE.equals(location.getScheme()) && (flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0)
return null;
- File localFile = getLocalFile(location, sub.newChild(300));
+ File localFile = getLocalFile(location, sub.newChild(100));
InputStream inStream = new BufferedInputStream(new FileInputStream(localFile));
JarInputStream jarStream = null;
try {
@@ -106,13 +106,14 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
throw new IOException(NLS.bind(Messages.io_invalidLocation, location.getPath()));
}
//parse the repository descriptor file
- sub.setWorkRemaining(100);
+ sub.setWorkRemaining(300);
InputStream descriptorStream = jarStream != null ? jarStream : inStream;
CompositeRepositoryIO io = new CompositeRepositoryIO();
CompositeRepositoryState resultState = io.read(localFile.toURL(), descriptorStream, CompositeArtifactRepository.PI_REPOSITORY_TYPE, sub.newChild(100));
if (resultState.getLocation() == null)
resultState.setLocation(location);
- CompositeArtifactRepository result = new CompositeArtifactRepository(getManager(), resultState);
+ // Spending half the time in creating the repo is due to the loading of the children that happens during that period
+ CompositeArtifactRepository result = new CompositeArtifactRepository(getManager(), resultState, sub.newChild(200));
if (Tracing.DEBUG_METADATA_PARSING) {
time += System.currentTimeMillis();
Tracing.debug(debugMsg + "time (ms): " + time); //$NON-NLS-1$

Back to the top