Check for subnode condition when retrieving a subnode as property.
This commit is contained in:
parent
fdced7ceed
commit
bdf416d1c6
1 changed files with 11 additions and 2 deletions
|
@ -218,6 +218,13 @@ public final class NodeManager {
|
||||||
// try to get the node from the shared cache
|
// try to get the node from the shared cache
|
||||||
node = (Node) cache.get (key);
|
node = (Node) cache.get (key);
|
||||||
|
|
||||||
|
// 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 (rel.subnodesAreProperties && node != null && node.getState() != Node.INVALID) {
|
||||||
|
if (home.contains (node) < 0)
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
|
||||||
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
|
// The requested node isn't in the shared cache. Synchronize with key to make sure only one
|
||||||
|
@ -235,8 +242,9 @@ public final class NodeManager {
|
||||||
// no need to check for oldnode != node because we fetched a new node from db
|
// no need to check for oldnode != node because we fetched a new node from db
|
||||||
if (oldnode != null && oldnode != nullNode && oldnode.getState () != Node.INVALID) {
|
if (oldnode != null && oldnode != nullNode && oldnode.getState () != Node.INVALID) {
|
||||||
cache.put (primKey, oldnode);
|
cache.put (primKey, oldnode);
|
||||||
if (!keyIsPrimary)
|
if (!keyIsPrimary) {
|
||||||
cache.put (key, oldnode);
|
cache.put (key, oldnode);
|
||||||
|
}
|
||||||
node = oldnode;
|
node = oldnode;
|
||||||
} else if (!keyIsPrimary) {
|
} else if (!keyIsPrimary) {
|
||||||
// cache node with secondary key
|
// cache node with secondary key
|
||||||
|
@ -252,8 +260,9 @@ public final class NodeManager {
|
||||||
Key primKey = oldnode.getKey ();
|
Key primKey = oldnode.getKey ();
|
||||||
boolean keyIsPrimary = primKey.equals (key);
|
boolean keyIsPrimary = primKey.equals (key);
|
||||||
cache.put (oldnode.getKey (), oldnode);
|
cache.put (oldnode.getKey (), oldnode);
|
||||||
if (!keyIsPrimary)
|
if (!keyIsPrimary) {
|
||||||
cache.put (key, oldnode);
|
cache.put (key, oldnode);
|
||||||
|
}
|
||||||
node = oldnode;
|
node = oldnode;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue