diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-03-30 17:09:27 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-03-30 17:09:27 +0200 |
| commit | dacd1dc403149c6322edbb4d2402ef121bde6f2b (patch) | |
| tree | ac3c4cf60302490b6eeca1d111ec5e2a079f2892 /source/com/c2kernel | |
| parent | 66713067c5d9f46e0406f812856cd9a5b0167a3e (diff) | |
Cache RemoteMaps if they are not related to a transaction
Diffstat (limited to 'source/com/c2kernel')
| -rw-r--r-- | source/com/c2kernel/persistency/ClusterStorageManager.java | 19 | ||||
| -rw-r--r-- | source/com/c2kernel/persistency/TransactionManager.java | 6 |
2 files changed, 21 insertions, 4 deletions
diff --git a/source/com/c2kernel/persistency/ClusterStorageManager.java b/source/com/c2kernel/persistency/ClusterStorageManager.java index b4515e0..756ac4d 100644 --- a/source/com/c2kernel/persistency/ClusterStorageManager.java +++ b/source/com/c2kernel/persistency/ClusterStorageManager.java @@ -8,8 +8,10 @@ import java.util.StringTokenizer; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.C2KLocalObject;
+import com.c2kernel.entity.agent.JobList;
import com.c2kernel.entity.proxy.EntityProxyManager;
import com.c2kernel.entity.proxy.ProxyMessage;
+import com.c2kernel.events.History;
import com.c2kernel.persistency.outcome.Outcome;
import com.c2kernel.persistency.outcome.Viewpoint;
import com.c2kernel.process.Gateway;
@@ -163,7 +165,7 @@ public class ClusterStorageManager { /** Internal get method. Retrieves clusters from ClusterStorages & maintains the memory cache */
public C2KLocalObject get(Integer sysKeyIntObj, String path) throws ClusterStorageException, ObjectNotFoundException {
- C2KLocalObject result;
+ C2KLocalObject result = null;
// check cache first
SoftCache<String, C2KLocalObject> sysKeyMemCache = null;
if (memoryCache.containsKey(sysKeyIntObj)) {
@@ -189,6 +191,21 @@ public class ClusterStorageManager { return data;
}
}
+
+ // deal out top level remote maps
+ if (path.indexOf('/') == -1) {
+ if (path.equals(ClusterStorage.HISTORY))
+ result = new History(sysKeyIntObj, null);
+ if (path.equals(ClusterStorage.JOB))
+ result = new JobList(sysKeyIntObj, null);
+ if (result!=null) {
+ synchronized(sysKeyMemCache) {
+ sysKeyMemCache.put(path, result);
+ }
+ return result;
+ }
+
+ }
// else try each reader in turn until we find it
ArrayList<ClusterStorage> readers = findStorages(ClusterStorage.getClusterType(path), false);
diff --git a/source/com/c2kernel/persistency/TransactionManager.java b/source/com/c2kernel/persistency/TransactionManager.java index 6f930b7..d2679a8 100644 --- a/source/com/c2kernel/persistency/TransactionManager.java +++ b/source/com/c2kernel/persistency/TransactionManager.java @@ -53,11 +53,11 @@ public class TransactionManager { ObjectNotFoundException {
if (path.startsWith("/") && path.length() > 1) path = path.substring(1);
- // deal out top level remote maps
+ // deal out top level remote maps, if transactions aren't needed
if (path.indexOf('/') == -1) {
- if (path.equals(ClusterStorage.HISTORY))
+ if (path.equals(ClusterStorage.HISTORY) && locker != null)
return new History(sysKey, locker);
- if (path.equals(ClusterStorage.JOB))
+ if (path.equals(ClusterStorage.JOB) && locker != null)
return new JobList(sysKey, locker);
}
|
