[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/loader/deadlock ...

Manik Surtani msurtani at jboss.com
Tue Jan 30 21:40:21 EST 2007


  User: msurtani
  Date: 07/01/30 21:40:21

  Modified:    tests/functional/org/jboss/cache/loader/deadlock 
                        ConcurrentCreationDeadlockTest.java
  Log:
  Removed dependency on concurrent.jar
  
  Revision  Changes    Path
  1.12      +8 -8      JBossCache/tests/functional/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentCreationDeadlockTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/deadlock/ConcurrentCreationDeadlockTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- ConcurrentCreationDeadlockTest.java	11 Jan 2007 13:49:21 -0000	1.11
  +++ ConcurrentCreationDeadlockTest.java	31 Jan 2007 02:40:21 -0000	1.12
  @@ -1,6 +1,5 @@
   package org.jboss.cache.loader.deadlock;
   
  -import EDU.oswego.cs.dl.util.concurrent.Latch;
   import junit.framework.Test;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  @@ -17,6 +16,7 @@
   import javax.naming.InitialContext;
   import javax.transaction.UserTransaction;
   import java.util.Properties;
  +import java.util.concurrent.CountDownLatch;
   
   /**
    * <b>Test based on a contribution by Marian Nokolov/Paul Miodonski at Siemens AG.</b>
  @@ -355,7 +355,7 @@
            }
            // start several worker threads to work with the same set of FQN's
            Worker[] t = new Worker[NUM_WORKERS];
  -         Latch latch = new Latch();
  +         CountDownLatch latch = new CountDownLatch(1);
            for (int j = 0; j < t.length; j++)
            {
               t[j] = new Worker(latch, NUM_FQNS_PER_RUN * i,
  @@ -363,7 +363,7 @@
               t[j].start();
            }
            // fire the workers to start processing
  -         latch.release();
  +         latch.countDown();
            // wait for all workers to complete
            for (int j = 0; j < t.length; j++)
            {
  @@ -400,14 +400,14 @@
       *
       * @author Marian Nikolov
       * @author $Author: msurtani $
  -    * @version $Date: 2007/01/11 13:49:21 $
  +    * @version $Date: 2007/01/31 02:40:21 $
       */
      private class Worker extends Thread
      {
         /**
          * Used to fire all workers at the same time.
          */
  -      private final Latch m_latch;
  +      private final CountDownLatch m_latch;
         /**
          * The start id, used as part of the node FQN.
          */
  @@ -435,7 +435,7 @@
          * @param modificationsPerTx The number of modifications per
          *                           transaction.
          */
  -      public Worker(Latch latch, int start, int count, int modificationsPerTx)
  +      public Worker(CountDownLatch latch, int start, int count, int modificationsPerTx)
         {
            m_latch = latch;
            m_start = start;
  @@ -452,7 +452,7 @@
            try
            {
               // the latch shall fire all workers at the same time
  -            m_latch.acquire();
  +            m_latch.await();
               for (int i = m_start; i < m_start + m_count; i++)
               {
                  m_state = -1;
  
  
  



More information about the jboss-cvs-commits mailing list