Package org.jboss.cache

Examples of org.jboss.cache.DataNode


      for (Iterator it = internalFqns.iterator(); it.hasNext();)
      {
         Fqn internalFqn = (Fqn) it.next();
         if (internalFqn.isChildOf(targetFqn))
         {
            DataNode internalNode = getInternalNode(target, internalFqn);
            if (internalNode != null)
               result.add(internalNode);
         }
      }
     
View Full Code Here


   }
  
   private DataNode getInternalNode(DataNode parent, Fqn internalFqn)
   {
      Object name = internalFqn.get(parent.getFqn().size());
      DataNode result = (DataNode) parent.getChild(name);
      if (result != null)
      {
         if (internalFqn.size() < result.getFqn().size())
         {
            // need to recursively walk down the tree
            result = getInternalNode(result, internalFqn);
         }
      }
View Full Code Here

   private void integrateRetainedNodes(DataNode root, Set retainedNodes)
   {
      Fqn rootFqn = root.getFqn();
      for (Iterator it = retainedNodes.iterator(); it.hasNext();)
      {
         DataNode retained = (DataNode) it.next();
         if (retained.getFqn().isChildOf(rootFqn))
         {
            integrateRetainedNode(root, retained);
         }
      }
   }
View Full Code Here

   private void integrateRetainedNode(DataNode ancestor, DataNode descendant)
   {
      Fqn descFqn = descendant.getFqn();
      Fqn ancFqn = ancestor.getFqn();
      Object name = descFqn.get(ancFqn.size());
      DataNode child = (DataNode) ancestor.getChild(name);
      if (ancFqn.size() == descFqn.size() + 1)
      {
         if (child == null)
         {
            ancestor.addChild(name, descendant);
View Full Code Here

      tx.begin();
      GlobalTransaction gtx = cache.getCurrentTransaction();
      cache.put("/a/b/c", null);
      cache.put("/a/b/c", null);

      DataNode n=cache.get("/a");
      IdentityLock lock=n.getLock();
      int num=lock.getReaderOwners().size();
      assertEquals(0, num);
      // make sure this is write locked.
      assertLocked(gtx, "/a", true);

      n=cache.get("/a/b");
      lock=n.getLock();
      num=lock.getReaderOwners().size();
      assertEquals(0, num);
      // make sure this is write locked.
      assertLocked(gtx, "/a/b", true);

      n=cache.get("/a/b/c");
      lock=n.getLock();
      num=lock.getReaderOwners().size();
      assertEquals(0, num);
      // make sure this is write locked.
      assertLocked(gtx, "/a/b/c", true);
View Full Code Here

      tx.rollback();
      assertEquals(0, cache.getNumberOfLocksHeld());
   }

   private void assertLocked(Object owner, String fqn, boolean write_locked) throws Exception{
      DataNode n=cache.peek(Fqn.fromString(fqn));
      IdentityLock lock=n.getLock();
      if(owner == null)
         owner=Thread.currentThread();
      assertTrue("node " + fqn + " is not locked", lock.isLocked());
      if(write_locked) {
         assertTrue("node " + fqn + " is not write-locked"  + (lock.isReadLocked() ? " but is read-locked instead!" : "!"), lock.isWriteLocked());
View Full Code Here

         m.put("name", "Bela");
         m.put("id", new Integer(322649));
         cache.put("/bela/ban", m);
         tx.rollback();

         DataNode n=cache.get("/bela/ban");
         if(n.getData() == null) return;
         assertEquals("map should be empty", 0, n.getData().size());
      }
      catch(Throwable t) {
         t.printStackTrace();
         fail(t.toString());
      }
View Full Code Here

  
   private void integrateAssociatedState() throws Exception
   {
      if (associatedSize > 0 && cache instanceof PojoCache) {
        
         DataNode refMapNode = cache.get(InternalDelegate.JBOSS_INTERNAL_MAP);

         ByteArrayInputStream in_stream=new ByteArrayInputStream(state, HEADER_LENGTH + transientSize, associatedSize);
         MarshalledValueInputStream in=new MarshalledValueInputStream(in_stream);
        
         try {
            Object[] nameValue;
            while ((nameValue = (Object[]) in.readObject()) != null) {
               TreeNode target = refMapNode.getChild(nameValue[0]);
              
               if (target == null) {
                  // Create the node
                  Fqn fqn = new Fqn(InternalDelegate.JBOSS_INTERNAL_MAP, nameValue[0]);
                  target = factory.createDataNode(nodeType,
                                                  nameValue[0],
                                                  fqn,
                                                  refMapNode,
                                                  null,
                                                  true,
                                                  cache);
                  refMapNode.addChild(nameValue[0], target);
               }
              
               target.put(nameValue[0], nameValue[1]);
            }
         }
View Full Code Here

           
            Map attrs = nd.getAttributes();
           
            // We handle this NodeData.  Create a DataNode and
            // integrate its data           
            DataNode target = factory.createDataNode(nodeType,
                                                     name,
                                                     fqn,
                                                     parent,
                                                     attrs,
                                                     true,
View Full Code Here

      if (fqn == null
            || fqn.size() == 0
            || fqn.isChildOf(InternalDelegate.JBOSS_INTERNAL))
         return;

      DataNode refMapNode = cache.get(InternalDelegate.JBOSS_INTERNAL_MAP);
     
      Map children = null;
      if (refMapNode != null && (children = refMapNode.getChildren()) != null) {
        
         String targetFqn = ObjectUtil.getIndirectFqn(fqn.toString());
        
         Map.Entry entry;
         String key;
         DataNode value;
         for (Iterator iter = children.entrySet().iterator(); iter.hasNext();) {
            entry = (Map.Entry) iter.next();
            key = (String) entry.getKey();
            if (key.startsWith(targetFqn)) {
               value = (DataNode) entry.getValue();
               out.writeObject(new Object[] { key, value.get(key) });
            }
         }
      }
     
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.DataNode

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.