Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengxin Zhu2011-11-21 03:39:34 +0000
committerMengxin Zhu2011-12-02 06:54:23 +0000
commit82aeb8dee11f4114494fe3dd0ca1097312d2dfd5 (patch)
tree02d2cbcb2c5afbfe055c6d193b6009fb53668e1f /bundles/org.eclipse.equinox.p2.artifact.repository
parente50188320c5e998c80ee4a4c6a3e60d426336e68 (diff)
downloadrt.equinox.p2-82aeb8dee11f4114494fe3dd0ca1097312d2dfd5.tar.gz
rt.equinox.p2-82aeb8dee11f4114494fe3dd0ca1097312d2dfd5.tar.xz
rt.equinox.p2-82aeb8dee11f4114494fe3dd0ca1097312d2dfd5.zip
Fix 351944 to avoid unnecessary loading artifact repository when doing query, getting artifact descriptors via artifact key.v20111202-0654
Without fixing though simple artifact repository always checks the last modify of artifacts.jar file, however it still cost some time, it will waste a lot of time especially the repository locates on a read-only NFS server. Signed-off-by: Mengxin Zhu <kane.zhu@windriver.com>
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.java16
1 files changed, 12 insertions, 4 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 b365b0376..79970410d 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
@@ -84,6 +84,11 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
* Does this instance of the repository currently hold a lock
*/
private boolean holdsLock = false;
+ /**
+ * Does this instance of the repository can be locked.
+ * It will be initialized when initializing the location for repository
+ */
+ private Boolean canLock = null;
private long cacheTimestamp = 0l;
@@ -327,7 +332,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
boolean lockAcquired = false;
try {
- if (canLock()) {
+ canLock = new Boolean(canLock());
+ if (canLock.booleanValue()) {
lockAcquired = lockAndLoad(true, new NullProgressMonitor());
if (!lockAcquired)
throw new IllegalStateException("Cannot acquire the lock for " + location); //$NON-NLS-1$
@@ -973,6 +979,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
desc.setRepository(this);
if (updateTimestamp)
updateTimestamp();
+ if (canLock == null)
+ canLock = new Boolean(canLock());
}
private String getBlobStoreName(String defaultValue) {
@@ -1425,11 +1433,11 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
/**
- * Returns true if this instance of SimpleArtifactRepository holds the lock,
- * false otherwise.
+ * Returns true if this instance of SimpleArtifactRepository holds the lock or
+ * this repository can't be locked at all due to permission, false otherwise.
*/
private boolean holdsLock() {
- return holdsLock;
+ return (canLock != null && !canLock.booleanValue()) || holdsLock;
}
/**URIUtil.toURI(location.toURI()

Back to the top