org.jboss.cache.Node.addChild()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中org.jboss.cache.Node.addChild()方法的一些代码示例,展示了Node.addChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.addChild()方法的具体详情如下:
包路径:org.jboss.cache.Node
类名称:Node
方法名:addChild

Node.addChild介绍

[英]Adds a child node with the given Fqn under the current node. Returns the newly created node.

If the child exists returns the child node anyway. Guaranteed to return a non-null node.

The Fqn passed in is relative to the current node. The new child node will have an absolute fqn calculated as follows:

new Fqn(getFqn(), f)

. See Fqn for the operation of this constructor.
[中]在当前节点下添加具有给定Fqn的子节点。返回新创建的节点。
如果子节点存在,则返回子节点。保证返回非空节点。
传入的Fqn是相对于当前节点的。新子节点的绝对fqn计算如下:

new Fqn(getFqn(), f)

. 有关此构造函数的操作,请参见Fqn。

代码示例

代码示例来源:origin: org.jboss.cache/jbosscache-core

@Override
@SuppressWarnings("unchecked")
public V put(K arg0, V arg1)
{
  return (V) node.addChild(Fqn.fromElements(arg0)).put(KEY, arg1);
}

代码示例来源:origin: org.mobicents.ha.javax.sip/restcomm-jain-sip-jboss5

public void putDialog(SIPDialog dialog) throws SipCacheException {
  UserTransaction tx = null;
  try {
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
    tx = (UserTransaction) new InitialContext(prop).lookup("UserTransaction");
    if(tx != null) {
      tx.begin();
    }
    Node dialogNode = dialogRootNode.addChild(Fqn.fromString(dialog.getDialogId()));
    dialogNode.put(dialog.getDialogId(), dialog);
    if(tx != null) {
      tx.commit();
    }
  } catch (Exception e) {
    if(tx != null) {
      try { tx.rollback(); } catch(Throwable t) {}
    }
    throw new SipCacheException("A problem occured while putting the following dialog " + dialog.getDialogId() + "  into JBoss Cache", e);
  } 
}

代码示例来源:origin: org.mobicents.ha.javax.sip/restcomm-jain-sip-jboss5

public void putServerTransaction(SIPServerTransaction serverTransaction)
    throws SipCacheException {
  UserTransaction tx = null;
  try {
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
    tx = (UserTransaction) new InitialContext(prop).lookup("UserTransaction");
    if(tx != null) {
      tx.begin();
    }
    Node serverTransactionNode = serverTxRootNode.addChild(Fqn.fromString(serverTransaction.getTransactionId()));
    serverTransactionNode.put(serverTransaction.getTransactionId(), serverTransaction);
    if(tx != null) {
      tx.commit();
    }
  } catch (Exception e) {
    if(tx != null) {
      try { tx.rollback(); } catch(Throwable t) {}
    }
    throw new SipCacheException("A problem occured while putting the following server transaction " + serverTransaction.getTransactionId() + "  into JBoss Cache", e);
  } 
}

代码示例来源:origin: org.mobicents.ha.javax.sip/restcomm-jain-sip-jboss5

tx.begin();
Node clientTransactionNode = clientTxRootNode.addChild(Fqn
    .fromString(clientTransaction.getTransactionId()));
clientTransactionNode.put(clientTransaction.getTransactionId(),

代码示例来源:origin: org.mobicents.ha.javax.sip/restcomm-jain-sip-jboss5

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));	
    }
  }
}

代码示例来源:origin: org.jboss.cache/jbosscache-core

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);
}

代码示例来源:origin: org.jboss.cache/jbosscache-core

subtreeRoot = root.addChild(fqn);
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);

代码示例来源:origin: org.hibernate/hibernate-jbosscache

added = root.addChild( fqn );

代码示例来源:origin: org.hibernate/hibernate-jbosscache2

added = root.addChild( fqn );

相关文章