summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2012-12-12 09:57:36 (EST)
committerPascal Rapicault2012-12-18 10:04:23 (EST)
commita0235c0c95b9047e64d6e24c9d8f6b8588087113 (patch)
treee96bb151235102380729a9fccc547178027ff7c9
parent1d0f129ca70716e7a181631e1ba0e71f16e35e08 (diff)
downloadrt.equinox.p2-a0235c0c95b9047e64d6e24c9d8f6b8588087113.zip
rt.equinox.p2-a0235c0c95b9047e64d6e24c9d8f6b8588087113.tar.gz
rt.equinox.p2-a0235c0c95b9047e64d6e24c9d8f6b8588087113.tar.bz2
Obtain specific profile state properties without locking
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index ffa5934..9e2eb44 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -257,7 +257,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
private boolean ignoreExistingProfile(IProfile profile) {
- if (internalGetProfileStateProperties(profile, profile.getTimestamp()).containsKey("NEW"))
+ if (internalGetProfileStateProperties(profile, profile.getTimestamp(), false).containsKey("NEW"))
return false;
return "true".equals(System.getProperty("eclipse.ignoreUserConfiguration"));
}
@@ -1092,14 +1092,16 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
public Map<String, String> getProfileStateProperties(String id, long timestamp) {
if (id == null)
throw new NullPointerException();
- return internalGetProfileStateProperties(internalGetProfile(id), timestamp);
+ return internalGetProfileStateProperties(internalGetProfile(id), timestamp, true);
}
- private Map<String, String> internalGetProfileStateProperties(IProfile profile, long timestamp) {
+ private Map<String, String> internalGetProfileStateProperties(IProfile profile, long timestamp, boolean lock) {
Map<String, String> result = new HashMap<String, String>();
String timestampString = String.valueOf(timestamp);
int keyOffset = timestampString.length() + 1;
- internalLockProfile(profile);
+ lock = lock || lastAccessedProperties == null;
+ if (lock)
+ internalLockProfile(profile);
try {
Properties properties = readStateProperties(profile.getProfileId());
Iterator<Object> keys = properties.keySet().iterator();
@@ -1111,7 +1113,8 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
} catch (ProvisionException e) {
LogHelper.log(e);
} finally {
- internalUnlockProfile(profile);
+ if (lock)
+ internalUnlockProfile(profile);
}
return result;
}