r9861 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Thu, 10 Sep 2009 01:19:46 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090909231946.26DA53D0E3@mia>
Author: hannes
Date: 2009-09-10 01:19:45 +0200 (Thu, 10 Sep 2009)
New Revision: 9861

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/NodeManager.java
Log:
Fix bug where aggressive cachemode influences caching behaviour of complex reference.

Details at http://dev.helma.org/trac/helma/changeset/9861

Modified: helma/helma/trunk/src/helma/objectmodel/db/NodeManager.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/NodeManager.java	2009-09-08 20:29:56 UTC (rev 9860)
+++ helma/helma/trunk/src/helma/objectmodel/db/NodeManager.java	2009-09-09 23:19:45 UTC (rev 9861)
@@ -219,7 +219,7 @@
         // See if Transactor has already come across this node
         Node node = tx.getCleanNode(key);
 
-        if ((node != null) && (node.getState() != Node.INVALID)) {
+        if (node != null && node.getState() != Node.INVALID) {
             // we used to refresh the node in the main cache here to avoid the primary key
             // entry being flushed from cache before the secondary one
             // (risking duplicate nodes in cache) but we don't need to since we fetched
@@ -233,10 +233,11 @@
 
         // check if we can use the cached node without further checks.
         // we need further checks for subnodes fetched by name if the subnodes were changed.
-        if ((node != null) && (node.getState() != Node.INVALID)) {
+        if (node != null && node.getState() != Node.INVALID) {
             // check if node is null node (cached null)
             if (node.isNullNode()) {
-                if (node.created != home.getLastSubnodeChange()) {
+                // do not check reference nodes against child collection
+                if (rel.isComplexReference() || node.created != home.getLastSubnodeChange()) {
                     node = null; //  cached null not valid anymore
                 }
             } else if (!rel.virtual) {
@@ -256,7 +257,7 @@
             }
         }
 
-        if ((node == null) || (node.getState() == Node.INVALID)) {
+        if (node == null || node.getState() == Node.INVALID) {
             // The requested node isn't in the shared cache.
             // Synchronize with key to make sure only one version is fetched
             // from the database.