Package org.jboss.cache

Examples of org.jboss.cache.Node


    // System.out.println(root.getFqn());
    fqnList.add(root.getFqn().toString());

    Iterator<Node> iterator = root.getChildren().iterator();
    while (iterator.hasNext()) {
      Node node = iterator.next();
      initFQNList(node);
    }
  }
View Full Code Here


   @Override
   public Object get(String region, String key)
   {
      try
      {
         Node node = cache.get(getFqn(region));
         if (node != null)
         {
            return node.get(key);
         }
         else
         {
            return null;
         }
View Full Code Here

  }

  public void testOnFlushCache() throws Exception {
    setUpTreeCache();
    cacheFacade.onFlushCache(flushingModel);
    Node cacheNode = treeCache.get(NODE_FQN);
    assertNull(cacheNode);
  }
View Full Code Here

            // The rest only matters for optimistic locking, where we
            // need to establish the proper data version on the region root
           
            // Don't hold a transactional lock for this
            Transaction tx = suspend();
            Node newRoot = null;
            try {
                 // Make sure the root node for the region exists and
                 // has a DataVersion that never complains
                 newRoot = jbcCache.getRoot().getChild( regionFqn );
                 if (newRoot == null || !newRoot.isValid()) {               
                     // Establish the region root node with a non-locking data version
                     DataVersion version = optimistic ? NonLockingDataVersion.INSTANCE : null;
                     newRoot = CacheHelper.addNode(jbcCache, regionFqn, true, true, version);   
                 }
                 else if (newRoot instanceof NodeSPI) {
                     // FIXME Hacky workaround to JBCACHE-1202
                     if ( !( ( ( NodeSPI ) newRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
                          ((NodeSPI) newRoot).setVersion(NonLockingDataVersion.INSTANCE);
                     }
                 }
                 // Never evict this node
                 newRoot.setResident(true);
                 establishInternalNodes();
            }
            finally {
                resume(tx);
                regionRoot = newRoot;
View Full Code Here

    public static boolean isSynchronous(Configuration.CacheMode cacheMode) {
        return cacheMode == Configuration.CacheMode.REPL_SYNC || cacheMode == Configuration.CacheMode.INVALIDATION_SYNC;
    }
   
    public static Set getChildrenNames(Cache cache, Fqn fqn) {
        Node node = cache.getRoot().getChild(fqn);
        return (node != null) ? node.getChildrenNames() : Collections.emptySet();
    }
View Full Code Here

                option = new Option();
                option.setCacheModeLocal(localOnly);
                option.setDataVersion(version);
            }
           
            Node root = cache.getRoot();
            setInvocationOption(cache, option);
            // FIXME hack to work around fact that calling
            // Node added = root.addChild( fqn ); doesn't
            // properly set the version on the node
            Node added = null;
            if (version == null) {
                added = root.addChild( fqn );
            }
            else {
                cache.put(fqn, DUMMY, DUMMY);
                added = root.getChild(fqn);
            }
            if (resident)
                added.setResident(true);
            return added;
        }
        catch (Exception e) {
            throw new CacheException(e);
        }
View Full Code Here

   public Collection<String> getAllCategories()
   {
      try
      {
         @SuppressWarnings("unchecked")
         Node base = this.cache.getRoot().getChild(ROOTFQN);
         @SuppressWarnings("unchecked")
         Collection<String> keys = (base == null ? null : base.getChildrenNames());
         if (keys != null && keys.size() > 0)
         {
            keys = Collections.unmodifiableCollection(keys);
         }
         return keys;
View Full Code Here

      for (Fqn internalFqn : internalFqns)
      {
         if (internalFqn.isChildOf(target))
         {
            prepareContextOptions();
            Node node = getInternalNode(cache.getNode(target), internalFqn);
            if (node != null)
            {
               result.add(node.getFqn());
            }
         }
      }

      return result;
View Full Code Here

   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);
      }
View Full Code Here

   }
  
   private Set<String> getSSOIds() throws Exception
   {
      Fqn<String> ssoRootFqn = Fqn.fromElements(SSO);
      @SuppressWarnings("unchecked")
      Node ssoRoot = cache.getRoot().getChild(ssoRootFqn);
      @SuppressWarnings("unchecked")
      Set<String> result = ssoRoot == null ? new HashSet<String>() : ssoRoot.getChildrenNames();
      return result;
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.