[exo-jcr-commits] exo-jcr SVN: r877 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/load/perf and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Nov 26 06:33:25 EST 2009


Author: tolusha
Date: 2009-11-26 06:33:24 -0500 (Thu, 26 Nov 2009)
New Revision: 877

Modified:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
Log:
EXOJCR-221: comments added, NodeImpl.hasNodes() improvements

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java	2009-11-26 11:13:27 UTC (rev 876)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java	2009-11-26 11:33:24 UTC (rev 877)
@@ -765,8 +765,26 @@
       return data.getIdentifier().equals(Constants.ROOT_UUID);
    }
 
+   /**
+    * Loads data
+    *
+    * @param data
+    *          source item data
+    * @throws RepositoryException 
+    *          if errors occurs
+    */
    abstract void loadData(ItemData data) throws RepositoryException;
 
+   /**
+    * Loads data.
+    *
+    * @param data
+    *          source item data
+    * @param itemDefinitionData
+    *          source item definition data
+    * @throws RepositoryException
+    *          if errors occurs
+    */
    abstract void loadData(ItemData data, ItemDefinitionData itemDefinitionData) throws RepositoryException;
 
    /**

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java	2009-11-26 11:13:27 UTC (rev 876)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java	2009-11-26 11:33:24 UTC (rev 877)
@@ -156,7 +156,7 @@
     * @param data
     *          Node data
     * @param parent
-    *          Parent node data
+    *          parent node data is used for simple calculation item definition
     * @param session    
     *          Session
     * @throws RepositoryException
@@ -1254,7 +1254,7 @@
 
       checkValid();
 
-      return dataManager.getChildNodesData(nodeData()).size() > 0;
+      return dataManager.getChildNodesCount(nodeData()) > 0;
    }
 
    /**
@@ -1384,7 +1384,14 @@
    }
 
    /**
-    * {@inheritDoc}
+    * Loads data.
+    *
+    * @param data
+    *          source item data for load 
+    * @param parent
+    *          parent node data is used for simple calculation item definition
+    * @throws RepositoryException 
+    *          if error occurs
     */
    private void loadData(ItemData data, NodeData parent) throws RepositoryException, InvalidItemStateException,
       ConstraintViolationException

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java	2009-11-26 11:13:27 UTC (rev 876)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java	2009-11-26 11:33:24 UTC (rev 877)
@@ -19,7 +19,11 @@
 import org.exoplatform.services.jcr.JcrAPIBaseTest;
 import org.exoplatform.services.jcr.impl.core.SessionImpl;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
@@ -35,14 +39,16 @@
 {
    private static final String testName = "testRoot";
 
-   private static final int sessionCount = 1;
+   private static final int sessionCount = 20;
 
-   private static final int tryCount = 10;
+   private static final int tryCount = 5;
 
    private Session[] sessions = new Session[sessionCount];
 
    private GetNodesThread[] threads = new GetNodesThread[sessionCount];
 
+   private NodeIterator[][] nodes = new NodeIterator[sessionCount][tryCount];
+
    public void testGetNodes() throws Exception
    {
 
@@ -73,7 +79,7 @@
       log.info("getting nodes...");
       for (int i = 0; i < sessionCount; i++)
       {
-         threads[i] = new GetNodesThread(sessions[i]);
+         threads[i] = new GetNodesThread(sessions[i], i);
          threads[i].start();
       }
 
@@ -90,16 +96,19 @@
 
          break;
       }
-      log.info("Memory used: " + (rt.totalMemory() - rt.freeMemory() - usedMemory) / 1024 + "Kb");
+      log.info("Memory used: " + (rt.totalMemory() - rt.freeMemory() - usedMemory) / 1024 / 1024 + "Mb");
    }
 
    private class GetNodesThread extends Thread
    {
       private final Session curSession;
 
-      GetNodesThread(Session session)
+      private final int sessionNumber;
+
+      GetNodesThread(Session session, int sessionNumber)
       {
          this.curSession = session;
+         this.sessionNumber = sessionNumber;
       }
 
       @Override
@@ -114,9 +123,11 @@
                long startTime = System.currentTimeMillis();
                testRoot.getNodes();
                log.info("Total time: " + (System.currentTimeMillis() - startTime) / 1000 + "s");
+
+               Thread.sleep(30000);
             }
          }
-         catch (RepositoryException e)
+         catch (Exception e)
          {
             e.printStackTrace();
          }



More information about the exo-jcr-commits mailing list