import org.infinispan.tree.Fqn; import org.infinispan.tree.Node; import org.infinispan.tree.TreeCache; public class TreeCacheUtil { /** * Gets the value for the given FQN and key. *

* 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 node = cache.getNode(fqn); if (node != null) { value = node.get(key); Fqn parentFqn; do { Node 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; } }