org.jboss.cache.Node类的使用及代码示例

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

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

Node介绍

[英]A Node is a Fqn logical grouping of data in the JBoss Cache. A node should be used to contain data for a single data record, for example information about a particular person or account.

One purpose of grouping cache data into separate nodes is to minimize transaction locking interference, and increase concurrency. So for example, when multiple threads or possibly distributed caches are acccessing different accounts simultaneously.

Another is that when making changes to this node, its data might be kept in a single database row or file on disk. (Persisted via the use of a org.jboss.cache.loader.CacheLoader.)

A node has references to its children, parent (each node except the root - defined by Fqn#ROOT - has a single parent) and data contained within the node (as key/value pairs). The data access methods are similar to the collections Map interface, but some are read-only or return copies of the underlying the data.
[中]节点是JBoss缓存中数据的Fqn逻辑分组。节点应用于包含单个数据记录的数据,例如关于特定人员或帐户的信息。
将缓存数据分组到单独节点的一个目的是最小化事务锁定干扰,并提高并发性。例如,当多个线程或可能分布的缓存同时访问不同的帐户时。
另一个原因是,在对该节点进行更改时,其数据可能保存在单个数据库行或磁盘上的文件中。(通过使用org.jboss.cache.loader.CacheLoader保存。)
一个节点引用了它的子节点、父节点(除根节点(由Fqn#root定义)外的每个节点都有一个父节点)和节点中包含的数据(作为键/值对)。数据访问方法与collections Map接口类似,但有些是只读的,或者返回基础数据的副本。

代码示例

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

@Override
@SuppressWarnings("unchecked")
public V get(Object arg0)
{
  Node child = node.getChild(arg0);
  if (child == null)
   return null;
  return (V) child.get(KEY);
}

代码示例来源: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.hibernate/hibernate-jbosscache

public static Set getChildrenNames(Cache cache, Fqn fqn) {
  Node node = cache.getRoot().getChild(fqn);
  return (node != null) ? node.getChildrenNames() : Collections.emptySet();
}

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

@Override
public void clear()
{
  for (Object o : node.getChildrenNames())
   node.removeChild(o);
}

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

@Override
@SuppressWarnings("unchecked")
public V remove(Object arg0)
{
  Node child = node.getChild(arg0);
  if (child == null)
   return null;
  V o = (V) child.remove(KEY);
  node.removeChild(arg0);
  return o;
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-jboss5-ha-server-cache

public Map<String, String> getSipSessionKeys() {
  Map<String, String> result = new HashMap<String, String>();
  Fqn<String> sipappFqn = getSipappFqn();
  Node<Object, Object> bbRoot = jBossCacheService.getCache().getRoot()
      .getChild(jBossCacheService.BUDDY_BACKUP_FQN);
  if (bbRoot != null) {
    Set<Node<Object, Object>> owners = bbRoot.getChildren();
    if (owners != null) {
      for (Node<Object, Object> owner : owners) {
        @SuppressWarnings("unchecked")
        Node sipRoot = owner.getChild(sipappFqn);
        if (sipRoot != null) {
          @SuppressWarnings("unchecked")
          Set<String> ids = sipRoot.getChildrenNames();
          storeSipSessionOwners(ids, (String) owner.getFqn()
              .getLastElement(), result);
        }
      }
    }
  }
  storeSipSessionOwners(jBossCacheService.getChildrenNames(sipappFqn), null,
      result);
  return result;
}

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

added = root.addChild( fqn );
  added = root.getChild(fqn);
  added.setResident(true);
return added;

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

regionRoot = jbcCache.getRoot().getChild( regionFqn );
if (regionRoot == null || !regionRoot.isValid()) {
if (!regionRoot.isResident()) {
  regionRoot.setResident(true);

代码示例来源:origin: Verigreen/verigreen

private void populateValues(Node<String, Object> cache, ArrayList<V> list) {
  
  Set<Node<String, Object>> children = cache.getChildren();
  for (Node<String, Object> node : children) {
    Iterator<String> iterator = node.getKeys().iterator();
    if (iterator.hasNext()) {
      String key = iterator.next();
      V value = RuntimeUtils.<V> cast(node.get(key));
      list.add(getClonedValue(value));
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-jboss5-ha-server-cache

public Map<String, Object> getSipSessionAttributes(
    String sipApplicationSessionKey,
    String sipSessionKey) {
  if (sipSessionKey == null) {
    @SuppressWarnings("unchecked")
    Map<String, Object> empty = Collections.EMPTY_MAP;
    return empty;
  }
  Fqn<String> fqn = delegate.getSipSessionFqn(combinedPath_,
      sipApplicationSessionKey, sipSessionKey);
  Node<Object, Object> node = getCache().getRoot().getChild(Fqn.fromString(fqn.toString() + "/" + AbstractJBossCacheService.ATTRIBUTE_KEY));
  Map<Object, Object> rawData = node.getData();
  return getSessionAttributes(null, rawData);
}

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

private Node getInternalNode(Node parentNode, Fqn internalFqn)
{
 Fqn parentFqn = parentNode.getFqn();
 Object name = internalFqn.get(parentFqn.size());
 prepareContextOptions();
 Node result = parentNode.getChild(name);
 if (result != null && internalFqn.size() < result.getFqn().size())
 {
   // need to recursively walk down the tree
   result = getInternalNode(result, internalFqn);
 }
 return result;
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-jboss5-ha-server-cache

public Set<String> getSipApplicationSessionAttributeKeys(
    String sipApplicationSessionKey) {
  Set keys = null;
  Fqn<String> fqn = delegate.getSipApplicationSessionFqn(combinedPath_,
      sipApplicationSessionKey);
  try {
    Node<Object, Object> node = getCache().getRoot().getChild(Fqn.fromString(fqn.toString() + "/" + AbstractJBossCacheService.ATTRIBUTE_KEY));
    if (node != null) {
      keys = node.getKeys();
      keys.removeAll(INTERNAL_KEYS);
    }
  } catch (CacheException e) {
    log_.error(
        "getAttributeKeys(): Exception getting keys for session "
            + sipApplicationSessionKey, e);
  }
  return keys;
}

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

if (regionRoot != null && regionRoot.isValid()) {
  return;
  regionRoot = jbcCache.getRoot().getChild( regionFqn );
  return;
   newRoot = jbcCache.getRoot().getChild( regionFqn );
   if (newRoot == null || !newRoot.isValid()) {                
   newRoot.setResident(true);

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

actualNode.getData();
actualNode.getChildrenNames();
if (trace) log.trace("Found node " + actualNode.getFqn() + " but it is not valid. Returning 'no data found'", e);
return GravitateResult.noDataFound();

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

private Fqn getFqn(Object o)
{
 if (o instanceof Node) return ((Node) o).getFqn();
 if (o instanceof InternalNode) return ((InternalNode) o).getFqn();
 throw new IllegalArgumentException();
}

代码示例来源:origin: org.jasig.cas/cas-server-integration-jboss

@Override
public Collection<Ticket> getTickets() {
  try {
    final Node<String, Ticket> node = this.cache.getNode(FQN_TICKET);
    if (node == null) {
      return Collections.emptyList();
    }
    final Set<String> keys = node.getKeys();
    final List<Ticket> list = new ArrayList<>();
    for (final String key : keys) {
      /**  Returns null if the node contains no mapping for this key. **/
      final Ticket ticket = node.get(key);
      if (ticket != null) {
        list.add(node.get(key));
      }
    }
    return list;
  } catch (final CacheException e) {
    return Collections.emptyList();
  }
}

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

/**
 * getData returns a snapshot of the data.
 */
@Override
public Set<Map.Entry<K, V>> entrySet()
{
  return node.getData().entrySet();
}

代码示例来源: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.mobicents.core/mobicents-core-jar

Map profiles = childNode.getChildren();
if (profiles != null) {
  Iterator profilesIt = profiles.values().iterator();
    String profileName = profileNode.getFqn()
        .toString().substring(
            (profileManager.getRootFqn() + "/profile:"

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

@Override
@SuppressWarnings("unchecked")
public V get(Object key)
{
  return node.get((K) key);
}

相关文章