Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengxin Zhu2011-11-20 22:39:34 -0500
committerMengxin Zhu2011-12-07 01:46:31 -0500
commitf57a1651a3ed5baa7393d575b7f8726b31707d28 (patch)
treefe1ed2ab233d4a83e6ad661d18a26661099701df /bundles/org.eclipse.equinox.p2.artifact.repository
parent3ab674b9e4971c53b190f7d77f17c75ee13df4a0 (diff)
downloadrt.equinox.p2-f57a1651a3ed5baa7393d575b7f8726b31707d28.tar.gz
rt.equinox.p2-f57a1651a3ed5baa7393d575b7f8726b31707d28.tar.xz
rt.equinox.p2-f57a1651a3ed5baa7393d575b7f8726b31707d28.zip
Fix 351944 to avoid unnecessary loading artifact repository when doing query, getting artifact descriptors via artifact key.v20111207-0646
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. This version of fix introduces the dependency on o.e.core.filesystem to use EFS API to change the file permission crossing platforms. 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