From dacd1dc403149c6322edbb4d2402ef121bde6f2b Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 30 Mar 2012 17:09:27 +0200 Subject: Cache RemoteMaps if they are not related to a transaction --- .../c2kernel/persistency/ClusterStorageManager.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'source/com/c2kernel/persistency/ClusterStorageManager.java') 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 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 readers = findStorages(ClusterStorage.getClusterType(path), false); -- cgit v1.2.3