Author: mircea.markus
Date: 2009-09-10 09:25:26 -0400 (Thu, 10 Sep 2009)
New Revision: 8218
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
Log:
[JBCACHE-1539] - fixed regressions - it is possible that the returned node map to be
immutable. If needs to be amended, create a defensive copt and add data there
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2009-09-09
15:36:57 UTC (rev 8217)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2009-09-10
13:25:26 UTC (rev 8218)
@@ -323,7 +323,7 @@
}
if (nodeData != null && n != null)
{
- setNodeState(ctx, fqn, n, nodeData);
+ nodeData = setNodeState(ctx, fqn, n, nodeData);
}
}
}
@@ -460,7 +460,7 @@
* If it doesn't exist on disk but in memory, clears the
* uninitialized flag, otherwise returns null.
*/
- private void setNodeState(InvocationContext ctx, Fqn fqn, NodeSPI n, Map nodeData)
throws Exception
+ private Map setNodeState(InvocationContext ctx, Fqn fqn, NodeSPI n, Map nodeData)
throws Exception
{
if (trace) log.trace("setNodeState node is " + n);
if (nodeData != null)
@@ -470,8 +470,17 @@
{
notifier.notifyNodeActivated(fqn, true, Collections.emptyMap(), ctx);
}
+
+ Map internalState = n.getInternalState(false);
+ if (internalState != null && !internalState.isEmpty())
+ {
+ nodeData = new HashMap(nodeData);
+ nodeData.putAll(internalState);
+ }
- nodeData.putAll(n.getInternalState(false));
+
+
+// nodeData.putAll(n.getInternalState(false));
n.setInternalState(nodeData);
// set this node as valid?
@@ -489,6 +498,7 @@
if (trace) log.trace("Setting dataLoaded to true");
n.setDataLoaded(true);
}
+ return nodeData;
}
private Map loadData(InvocationContext ctx, Fqn fqn) throws Exception