public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent, Map<K, V> data) { UnversionedNode<K, V> internal = createInternalNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, data); return initializeNodeInvocationDelegate(internal); }
public boolean removeChild(Fqn f) { if (f.size() == 1) { return removeChild(f.getLastElement()); } else { NodeSPI<K, V> child = getChildDirect(f); return child != null && child.getParentDirect().removeChildDirect(f.getLastElement()); } }
public void start() { CacheFactory<String, Object> factory = new DefaultCacheFactory<>(); String configFileName = CONFIG_PATH; _cache = factory.createCache(configFileName, false); _cache.create(); _cache.start(); } }
private void removeNode(Fqn fqn) { InternalNode targetNode = peekInternalNode(fqn, true); if (targetNode == null) return; InternalNode parentNode = peekInternalNode(fqn.getParent(), true); targetNode.setValid(false, false); if (parentNode != null) { parentNode.removeChild(fqn.getLastElement()); parentNode.setChildrenLoaded(false); } }
private void removeNodeLegacy(Fqn fqn) { NodeSPI targetNode = peek(fqn, false, true); if (targetNode == null) return; NodeSPI parentNode = targetNode.getParentDirect(); targetNode.setValid(false, false); if (parentNode != null) { parentNode.removeChildDirect(fqn.getLastElement()); parentNode.setChildrenLoaded(false); } }
private void adjustFqn(NodeSPI node, Fqn newBase) { Fqn newFqn = Fqn.fromRelativeElements(newBase, node.getFqn().getLastElement()); node.setFqn(newFqn); }
public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data) { UnversionedNode<K, V> internal = createInternalNode(fqn.getLastElement(), fqn, parent, data); return initializeNodeInvocationDelegate(internal); }
@Override public NodeSPI<K, V> addChildDirect(Object o, boolean notify) { GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction(); return getOrCreateChild(o, gtx, true, notify, null); }
private NodeSPI<K, V> initializeNodeInvocationDelegate(UnversionedNode<K, V> internal) { // always assume that new nodes do not have data loaded internal.setDataLoaded(false); NodeSPI<K, V> nid = createNodeInvocationDelegate(internal, false); // back reference internal.setDelegate(nid); return nid; }
public Object perform(InvocationContext ctx) throws Throwable { if (enabled) rpcManager.getFlushTracker().block(); else rpcManager.getFlushTracker().unblock(); return null; }
private int numNodes(NodeSPI n) { int count = 1;// for n if (n != null) { for (Object child : n.getChildrenDirect()) { count += numNodes((NodeSPI) child); } } return count; }
/** * Checks whether a node represented by a given Fqn exists. * Deleted and invalid nodes are not considered. * * @return true if the node exists, false otherwise. */ public Object perform(InvocationContext ctx) { NodeSPI node = ctx.lookUpNode(fqn); return node != null && !node.isDeleted(); }
/** * mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will * be aware that it is no longer valid. */ protected void invalidateNode(NodeSPI node) { node.setValid(false, true); // root nodes can never be invalid if (fqn.isRoot()) node.setValid(true, false); // non-recursive. }
public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent) { UnversionedNode<K, V> internal = createInternalNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, null); return initializeNodeInvocationDelegate(internal); }
public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent) { UnversionedNode<K, V> internal = createInternalNode(fqn.getLastElement(), fqn, parent, null); return initializeNodeInvocationDelegate(internal); }
public NodeSPI<K, V> addChildAndAcquireLock(Object o, boolean notify, PessimisticNodeBasedLockManager.LockAcquirer la) { GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction(); return getOrCreateChild(o, gtx, true, notify, la); }