Package org.jboss.cache

Examples of org.jboss.cache.DataNode


    */
   private boolean allInitialized(DataNode n) {
      if (!n.getChildrenLoaded())
         return false;
      for (Iterator it=n.getChildren().values().iterator(); it.hasNext();) {
         DataNode child = (DataNode)it.next();
         if (child.containsKey(TreeCache.UNINITIALIZED))
            return false;
      }
      return true;
   }
View Full Code Here


               // been initialized, its children have been loaded
               // AND it was found in the cache loader (nodeLoaded = true).
               // Then notify the listeners that the node has been activated.
                Fqn fqn = (Fqn)args[1];
                if(fqn != null && cache.exists(fqn&& loader.exists(fqn)) {
                   DataNode n=getNode(fqn); // don't load
                   // node not null and attributes have been loaded?
                   if (n != null && !n.containsKey(TreeCache.UNINITIALIZED)) {
                      // has children?
                      if(n.hasChildren() && allInitialized(n)) {
                         // children have been loaded, remove the node
                         addRemoveMod(cache_loader_modifications, fqn);
                         txActs++;
                      }
                      // doesn't have children, check the cache loader
View Full Code Here

   /**
    * @see org.jboss.cache.loader.DelegatingCacheLoader#delegateGet(org.jboss.cache.Fqn)
    */
   protected Map delegateGet(Fqn name) throws Exception {
      DataNode n=(DataNode)this.doMethodCall( METHOD_GET_WITH_1_PARAM, new Object[] { name } );
      if(n == null)
         return null;
      return n.getData();
   }
View Full Code Here

      {
         int op;
         Fqn fqn;
         Object key, val, retval;
         Map map;
         DataNode n;
         boolean flag;
         byte[] state;

         while (t != null && Thread.currentThread().equals(t))
         {
            try
            {
               op = input.readInt();
            }
            catch (IOException e)
            {
               mylog.debug("Client closed socket");
               close();
               break;
            }

            try
            {
               output.reset();
               switch (op)
               {
                  case DelegatingCacheLoader.delegateGetChildrenNames:
                     fqn = (Fqn) input.readObject();
                     Set children = c.getChildrenNames(fqn);
                     output.writeObject(children)// this may be null - that's okay
                     break;
                  case DelegatingCacheLoader.delegateGetKey:
                     fqn = (Fqn) input.readObject();
                     key = input.readObject();
                     retval = c.get(fqn, key);
                     output.writeObject(retval);
                     break;
                  case DelegatingCacheLoader.delegateGet:
                     fqn = (Fqn) input.readObject();
                     n = c.get(fqn);
                     if (n == null)
                     { // node doesn't exist - return null
                        output.writeObject(n);
                        break;
                     }
                     map = n.getData();
                     if (map == null) map = new HashMap();
                     output.writeObject(map);
                     break;
                  case DelegatingCacheLoader.delegateExists:
                     fqn = (Fqn) input.readObject();
View Full Code Here

   /**
    * @see org.jboss.cache.loader.DelegatingCacheLoader#delegateGet(org.jboss.cache.Fqn)
    */
   protected Map delegateGet(Fqn name) throws Exception {
      DataNode n=this.remoteCache != null ? this.remoteCache.get(name) : null;
      if(n == null)
         return null;
       return n.getData();
   }
View Full Code Here

//   protected Object delegateGet(Fqn name, Object key) throws Exception {
//      return delegate.get(name, key);
//   }

   protected Map delegateGet(Fqn name) throws Exception {
      DataNode n=delegate.get(name);
      if(n == null) return null;
      // after this stage we know that the node exists.  So never return a null - at worst, an empty map.
      Map m=n.getData();
      if (m == null) m = new HashMap(0);
      return m;
   }
View Full Code Here

      this so only 1 thread attempts to load a given element */

      if (fqn != null)
      {

         DataNode n = cache.peek(fqn);
         if (log.isTraceEnabled())
            log.trace("load element " + fqn + " mustLoad=" + mustLoad(n, key));
         if (mustLoad(n, key))
         {
            if (initNode)
View Full Code Here

   /**
    * Creates a new memory node in preparation for storage.
    */
   private DataNode createTempNode(Fqn fqn, TransactionEntry entry) throws Exception
   {
      DataNode n = createNodes(fqn, entry);
      n.put(TreeCache.UNINITIALIZED, null);
      if (log.isTraceEnabled())
         log.trace("createTempNode n " + n);
      return n;
   }
View Full Code Here

      super.acquireLocksForStateTransfer(root, lockOwner, timeout, true, force);
      Fqn fqn = root.getFqn();
      if (fqn.size() > 0 &&
            !fqn.isChildOf(InternalDelegate.JBOSS_INTERNAL))
      {
         DataNode refMapNode = get(InternalDelegate.JBOSS_INTERNAL_MAP);
         if (refMapNode != null)
         {

            // Lock the internal map node but not its children to
            // prevent the addition of other children
            super.acquireLocksForStateTransfer(refMapNode, lockOwner, timeout,
                  false, force);

            // Walk through the children, and lock any whose name starts
            // with the string version of our root node's Fqn
            Map children = refMapNode.getChildren();
            if (children != null)
            {

               String targetFqn = ObjectUtil.getIndirectFqn(fqn);
View Full Code Here

      {
         if (releaseInternal)
         {
            try
            {
               DataNode refMapNode = get(InternalDelegate.JBOSS_INTERNAL_MAP);
               if (refMapNode != null)
               {
                  // Rather than going to the effort of identifying which
                  // child nodes we locked before, just release all children
                  super.releaseStateTransferLocks(refMapNode, lockOwner, true);
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.