[jboss-cvs] JBossAS SVN: r64705 - branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/statelesscreation/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 20 08:24:01 EDT 2007


Author: wolfc
Date: 2007-08-20 08:24:01 -0400 (Mon, 20 Aug 2007)
New Revision: 64705

Modified:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/statelesscreation/unit/MetricsUnitTestCase.java
Log:
EJBTHREE-1031: unit test speedup

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/statelesscreation/unit/MetricsUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/statelesscreation/unit/MetricsUnitTestCase.java	2007-08-20 12:22:29 UTC (rev 64704)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/statelesscreation/unit/MetricsUnitTestCase.java	2007-08-20 12:24:01 UTC (rev 64705)
@@ -50,32 +50,36 @@
       assertNotNull(slsb);
       assertEquals(1, slsb.getBeanCount());
       
-      for (int i = 0 ; i < 50 ; ++i)
+      Runnable r = new Runnable()
       {
-         Runnable r = new Runnable()
+         public void run()
          {
-            public void run()
+            try
             {
-               try
-               {
-                  InitialContext jndiContext = getInitialContext();
-                  for (int i = 0 ; i < 100 ; ++i)
-                  {                  
-                     DestroyRemote slsb = (DestroyRemote)jndiContext.lookup("DestroyStatelessBean/remote");              
-                     slsb.getBeanCount();
-                  }
+               InitialContext jndiContext = getInitialContext();
+               for (int i = 0 ; i < 100 ; ++i)
+               {                  
+                  DestroyRemote slsb = (DestroyRemote)jndiContext.lookup("DestroyStatelessBean/remote");              
+                  slsb.getBeanCount();
                }
-               catch (Exception e)
-               {
-                  e.printStackTrace();
-               }
             }
-         };
-         
-         new Thread(r).start();
+            catch (Exception e)
+            {
+               e.printStackTrace();
+            }
+         }
+      };
+      Thread threads[] = new Thread[50];
+      for (int i = 0 ; i < threads.length ; ++i)
+      {
+         threads[i] = new Thread(r);
+         threads[i].start();
       }
       
-      Thread.sleep(1 * 60 * 1000);  
+      for(Thread t : threads)
+      {
+         t.join(1 * 60 * 1000);
+      }
       
       MBeanServerConnection server = getServer();
       ObjectName testerName = new ObjectName("jboss.j2ee:jar=statelesscreation-test.jar,name=DestroyStatelessBean,service=EJB3");




More information about the jboss-cvs-commits mailing list