[
https://issues.jboss.org/browse/ISPN-1213?page=com.atlassian.jira.plugin....
]
Todd Ciezadlo edited comment on ISPN-1213 at 7/5/11 2:07 PM:
-------------------------------------------------------------
A work-around is to climb the parents and call Node.getNode(FQN) on each one instead of
Node.get(String,String) or Node.get(Fqn,String).
Attached TreeCacheUtil.java that does this (substituted String for the K generic).
was (Author: ciezadlo):
A work-around is to climb the parents and call Node.getNode(FQN) on each one instead
of Node.get(String,String) or Node.get(Fqn,String).
Example replacement method (generic K replaced with String):
/**
* Gets the value for the given FQN and key.
* <p>
* Traverses the parents of the given FQN to reset their idle times.
*
* @param fqn the FQN
* @param key the key
* @return value of the FQN and key; or null if non-existent
*/
private static Object getAndTouchParents(TreeCache cache, String fqn, String key) {
Object value = null;
Node<Object, Object> node = cache.getNode(fqn);
if (node != null) {
value = node.get(key);
Fqn parentFqn;
do {
Node<Object, Object> parent = node.getParent();
parentFqn = parent.getFqn();
if (parentFqn != null) {
cache.getNode(parentFqn); // touch the parent to reset the idle time
}
} while (parentFqn != null && !parentFqn.isRoot());
}
return value;
}
TreeCache expires parents that have children
--------------------------------------------
Key: ISPN-1213
URL:
https://issues.jboss.org/browse/ISPN-1213
Project: Infinispan
Issue Type: Bug
Components: Eviction
Affects Versions: 4.2.1.FINAL
Reporter: Todd Ciezadlo
Assignee: Manik Surtani
Fix For: 5.0.0.FINAL
Attachments: ExpirationTest.java, TreeCacheUtil.java
TreeCache parents expire according to the max-idle value even if they contain children.
This puts the tree cache in an inconsistent state since the "dangling" children
can be retrieved through TreeCache.get(FQN, String) calls, but cannot be traversed to
through TreeCache.getRoot() and Node.getChildren() calls.
Attached unit test to to reproduce.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira