private Fqn<Object> createFqn(Object key) { return Fqn.fromElements(key); }
/** * Returns the node name for this segment. */ protected final Fqn childName(int segment) { return Fqn.fromElements(Integer.toString(segment)); }
private Fqn<String> getFqn(K key) { return Fqn.fromElements(_cacheName, key.toString()); }
/** * Adds a depth number to the start of the FQN. */ private Fqn withDepth(Fqn name, int depth) { Fqn n = Fqn.fromElements(depth); return Fqn.fromRelativeList(n, name.peekElements()); }
@Override @SuppressWarnings("unchecked") public V put(K arg0, V arg1) { return (V) node.addChild(Fqn.fromElements(arg0)).put(KEY, arg1); }
public void evictDialog(String dialogId) { cache.evict(Fqn.fromElements(dialogRootNode.getFqn(), Fqn.fromString(dialogId))); }
public Object[] createNodes(Fqn fqn) { List<NodeSPI> result = new ArrayList<NodeSPI>(fqn.size()); Fqn tmpFqn = Fqn.ROOT; int size = fqn.size(); // root node NodeSPI n = root; for (int i = 0; i < size; i++) { Object childName = fqn.get(i); tmpFqn = Fqn.fromRelativeElements(tmpFqn, childName); NodeSPI childNode; Map children = n.getChildrenMapDirect(); childNode = (NodeSPI) children.get(childName); if (childNode == null) { childNode = n.addChildDirect(Fqn.fromElements(childName)); result.add(childNode); } n = childNode; } return new Object[]{result, n}; }
o.setCacheModeLocal(true); o.setSkipCacheStatusCheck(true); cache.put(Fqn.fromElements(BUDDY_BACKUP_SUBTREE, newGroup.getGroupName()), (Map) Collections.emptyMap());
public void start() throws SipCacheException { try { cache.start(); } catch (Exception e) { throw new SipCacheException("Couldn't start JBoss Cache", e); } dialogRootNode = cache.getRoot().getChild(SipCache.DIALOG_PARENT_FQN_ELEMENT); if(dialogRootNode == null) { dialogRootNode = cache.getRoot().addChild(Fqn.fromElements(SipCache.DIALOG_PARENT_FQN_ELEMENT)); } if(clusteredSipStack.getReplicationStrategy() == ReplicationStrategy.EarlyDialog) { serverTxRootNode = cache.getRoot().getChild(SipCache.SERVER_TX_PARENT_FQN_ELEMENT); if(serverTxRootNode == null) { serverTxRootNode = cache.getRoot().addChild(Fqn.fromElements(SipCache.SERVER_TX_PARENT_FQN_ELEMENT)); } } }
Fqn childFqn = Fqn.fromElements(name);// this is a RELATIVE Fqn!!
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); }
private Object handlePutCommand(InvocationContext ctx, DataCommand command, boolean zeroAcquisitionTimeout) throws Throwable { if ((ctx.isLockingSuppressed()) || configuration.getIsolationLevel() == IsolationLevel.NONE) { if (trace) log.trace("Suppressing locking, creating nodes if necessary"); int treeNodeSize = command.getFqn().size(); NodeSPI n = dataContainer.getRoot(); for (int i = 0; i < treeNodeSize; i++) { Object childName = command.getFqn().get(i); Fqn childFqn = Fqn.fromElements(childName); NodeSPI childNode = n.getChildDirect(childFqn); if (childNode == null) childNode = n.addChildDirect(childFqn); LockUtil.manageReverseRemove(ctx, childNode, true, null, commandsFactory); n = childNode; } } else { lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, true, zeroAcquisitionTimeout, false, true, null, false); } return invokeNextInterceptor(ctx, command); }
public boolean removeNode(Fqn fqn) { // special case if we are removing the root. Remove all children instead. if (fqn.isRoot()) { boolean result = true; // we need to preserve options InvocationContext ctx = getInvocationContext(); Option o = ctx.getOptionOverrides().copy(); Set<Fqn> internalFqns = getInternalFqns(); for (Object childName : peek(fqn, false, false).getChildrenNames()) { if (!internalFqns.contains(Fqn.fromElements(childName))) { ctx.setOptionOverrides(o.copy()); result = removeNode(Fqn.fromRelativeElements(fqn, childName)) && result; } } return result; } else { InvocationContext ctx = invocationContextContainer.get(); cacheStatusCheck(ctx); GlobalTransaction tx = transactionTable.getCurrentTransaction(); RemoveNodeCommand command = commandsFactory.buildRemoveNodeCommand(tx, fqn); Object retval = invoker.invoke(ctx, command); return retval != null && (Boolean) retval; } }
doRemove(txn, Fqn.fromElements(child));