Author: manik.surtani(a)jboss.com
Date: 2009-03-07 05:48:55 -0500 (Sat, 07 Mar 2009)
New Revision: 7871
Modified:
core/branches/flat/src/main/java/org/horizon/interceptors/CacheLoaderInterceptor.java
Log:
Comments and TODOs
Modified:
core/branches/flat/src/main/java/org/horizon/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/interceptors/CacheLoaderInterceptor.java 2009-03-06
15:36:14 UTC (rev 7870)
+++
core/branches/flat/src/main/java/org/horizon/interceptors/CacheLoaderInterceptor.java 2009-03-07
10:48:55 UTC (rev 7871)
@@ -105,6 +105,14 @@
}
private void loadIfNeeded(InvocationContext ctx, Object key) throws Throwable {
+
+ // TODO this needs re-ordering. Checking the loader first is too expensive for
cache hits if we already have this in memory.
+ // It is better to check in memory first, but we must also guard against concurrent
eviction and cache lookups
+ // since the loader may skip loading for a key in memory but the key is evicted
before it is read by the reader,
+ // returning incorrect results. TODO: Write a test for this.
+ // A potential solution is to test for the entry in memory, and then store it in
context if available. Else, check
+ // if it is in the loader.
+
if (!loader.containsKey(key)) {
log.trace("No need to load. Key doesn't exist in the loader.");
return;
Show replies by date