public Object call() throws Exception { final boolean debugEnabled = log.isDebugEnabled(); if (debugEnabled) log.debug("start pushing in-memory state to cache cacheLoader"); pushState(cache.getRoot()); if (debugEnabled) log.debug("in-memory state passed to cache cacheLoader successfully"); return null; } };
public Map<Object, Object> get(Fqn name) throws Exception { NodeSPI n = (NodeSPI) delegate.getRoot().getChild(name); if (n == null) return null; // after this stage we know that the node exists. So never return a null - at worst, an empty map. Map<Object, Object> m = n.getData(); if (m == null) m = Collections.emptyMap(); return m; }
public Set<?> getChildrenNames(Fqn fqn) throws Exception { Node node = delegate.getRoot().getChild(fqn); if (node == null) return null; Set cn = node.getChildrenNames(); // the cache loader contract is a bit different from the cache when it comes to dealing with childrenNames if (cn.isEmpty()) return null; return cn; }
public void removeData(Fqn fqn) throws Exception { Node node = delegate.getRoot().getChild(fqn); if (node != null) node.clearData(); }
removed.removeAll(newMembers); spi.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true); NodeSPI root = spi.getRoot(); if (root != null)
Node node = c.getRoot().getChild(fqn); Set<Object> children = node == null ? Collections.emptySet() : new HashSet(node.getChildrenNames()); output.writeObject(children); case TcpCacheOperations.EXISTS: fqn = (Fqn) input.readObject(); flag = c.getRoot().hasChild(fqn); output.writeObject(flag); break; case TcpCacheOperations.REMOVE_DATA: fqn = (Fqn) input.readObject(); node = c.getRoot().getChild(fqn); if (node != null)
InternalNode subtreeRoot = fqn.isRoot() ? cache.getRoot().getDelegationTarget() : cache.getNode(fqn).getDelegationTarget();
private Fqn getDefunctBackupRootFqn(Address dataOwner) { // the defunct Fqn should be: /_BUDDY_BACKUP_/dataOwnerAddess:DEAD/N // where N is a number. Fqn defunctRoot = buddyFqnTransformer.getDeadBackupRoot(dataOwner); cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true); cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true); Node<?, ?> root = cache.getRoot(); cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true); cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true); Node<?, ?> defunctRootNode = root.addChild(defunctRoot); SortedSet<Object> childrenNames = new TreeSet<Object>(defunctRootNode.getChildrenNames()); // will be naturally sorted. Integer childName = 1; if (!childrenNames.isEmpty()) { Integer lastChild = (Integer) childrenNames.last(); childName = lastChild + 1; } cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true); defunctRootNode.addChild(Fqn.fromElements(childName)); return Fqn.fromRelativeElements(defunctRoot, childName); }
break; case REMOVE_DATA: Node n = c.getRoot().getChild(m.getFqn()); if (n != null) n.clearData(); break;