[jboss-svn-commits] JBL Code SVN: r31441 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance: resource and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Feb 5 05:52:20 EST 2010


Author: whitingjr
Date: 2010-02-05 05:52:20 -0500 (Fri, 05 Feb 2010)
New Revision: 31441

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTask.java
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/resource/SynchronizeTask.java
Log:
Modified code to flush the 2nd resource when commit is called.


Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTask.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTask.java	2010-02-05 10:51:24 UTC (rev 31440)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/jdbc/JDBCTask.java	2010-02-05 10:52:20 UTC (rev 31441)
@@ -31,7 +31,6 @@
 import org.hibernate.Transaction;
 import org.hibernate.ejb.EntityManagerImpl;
 import org.jboss.jbossts.performance.configuration.ConcurrentTaskConfiguration;
-import org.jboss.jbossts.performance.profiler.Profiler;
 import org.jboss.jbossts.performance.task.RecursiveTask;
 import org.jboss.tm.TransactionLocal;
 import org.testng.Assert;
@@ -82,11 +81,6 @@
       writeUserB(emB, writeSQLResB);
       emA.getSession().getTransaction().commit();
       Assert.assertFalse(emA.isOpen());
-      boolean trip = false;
-      if (trip)
-      {
-         Profiler.
-      }
    }
    private void writeUserA(final EntityManager em, final String sql)
    {

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/resource/SynchronizeTask.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/resource/SynchronizeTask.java	2010-02-05 10:51:24 UTC (rev 31440)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/resource/SynchronizeTask.java	2010-02-05 10:52:20 UTC (rev 31441)
@@ -51,9 +51,9 @@
       Transaction transaction =emA.getSession().beginTransaction();
       TransactionLocal session = new TransactionLocal();
       
-      transaction.registerSynchronization(new SessionSynchronization(emA, transaction, true));
+      /* emA automatically has a synch established because it is associated with the em factory A.
+       * Whereas emB isn't and therefore the JDBCContext for B needs a synch added to flush updates. */
       transaction.registerSynchronization(new SessionSynchronization( emB, transaction, true  ) );
-      //transaction.registerSynchronization(new CacheSynchronization(emB.getSession(), ((SessionImpl)emB.getSession()).getJDBCContext(), transaction, emB.getTransaction())) ;
       
       /**
        * A read
@@ -83,10 +83,9 @@
       Assert.assertNotNull(userB);
       userB.setFirstname("Ben"+time);
       emB.merge(userB);
-      
-      resourceAFlush(emA);
-      resourceBFlush(emB);
-      emA.getSession().getTransaction().commit();
+      /* the commit call will cause hibernate to check for changes to entities, 
+       * flushing any changes in the queue (write behind) before commit. */
+      emA.getSession().getTransaction().commit(); 
    }
    
    public EntityManagerFactory getEMFactoryA()
@@ -118,7 +117,8 @@
 
       public void beforeCompletion()
       {
-//         this.manager.flush();
+         /* This implementatino assumes everything is ok and various statuses no not need checking.*/
+         this.manager.flush();
       }
 
       public void afterCompletion(int status)



More information about the jboss-svn-commits mailing list