The addRepository operations are fast because they do not do any IO, nor does it try to validate if the repo is valid, etc. It just tells p2 that there may be something of interest at this location.
On the other hand, the loadRepository can take quite some time since it will contact the server to download the repository files (e.g. content.[jar|xml], artifact/[xml|jar], composite*…) and load that in memory. With the repos I’ve seen, most of the cost of this operation goes into downloading the file.
From: p2-dev-bounces@xxxxxxxxxxx [mailto:p2-dev-bounces@xxxxxxxxxxx] On Behalf Of Dileepa Jayakody
Sent: September-11-12 1:06 AM
Subject: [p2-dev] Delay in adding a p2 Repository
In our platform, we use p2 as the provisioning platform. In our p2 Repository management code, we are adding a repository using below code segment;
IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.
IArtifactRepositoryManager artifactRepositoryManager = ServiceHolder.getArtifactRepositoryManager();
//adding metadata and artifact repositories
//Loading the metadata repository
metadataRepositoryManager.loadRepository(location, new NullProgressMonitor());
metadataRepositoryManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nickName);
//Loading the artifact repository
artifactRepositoryManager.loadRepository(location, new NullProgressMonitor());
artifactRepositoryManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nickName);
Sometimes we can notice a considerable delay when adding a repository. When you say artifactRepositoryManager.loadRepository(location, new NullProgressMonitor()); does p2 load all the InstallableUnits in the repository to memory? If so, could this be due to a long list of InstallableUnits in the repository.