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

Jimmy Wilson jawilson at redhat.com
Sun Jun 24 17:28:12 EDT 2007


  User: jawilson
  Date: 07/06/24 17:28:12

  Modified:    tests/functional/org/jboss/cache/lock  Tag:
                        Branch_JBossCache_1_4_0 StripedLockTest.java
  Log:
  Fix for [JBCACHE-1103] (backport).  Removed JDK 1.5-specific collections use.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +19 -11    JBossCache/tests/functional/org/jboss/cache/lock/StripedLockTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StripedLockTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/StripedLockTest.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -b -r1.1.2.2 -r1.1.2.3
  --- StripedLockTest.java	24 Jun 2007 20:22:54 -0000	1.1.2.2
  +++ StripedLockTest.java	24 Jun 2007 21:28:12 -0000	1.1.2.3
  @@ -5,6 +5,7 @@
   
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
   import java.util.Random;
  @@ -22,21 +23,28 @@
      public void testHashingDistribution()
      {
         // ensure even bucket distribution of lock stripes
  -      List<Fqn> fqns = createRandomFqns(1000);
  -
  -      Map<ReentrantReadWriteLock, Integer> distribution = new HashMap<ReentrantReadWriteLock, Integer>();
  -
  -      for (Fqn f : fqns)
  +      // Commented for JDK 1.4 use.
  +      //List<Fqn> fqns = createRandomFqns(1000);
  +      List fqns = createRandomFqns(1000);
  +
  +      //Commented for JDK 1.4 use.
  +      //Map<ReentrantReadWriteLock, Integer> distribution = new HashMap<ReentrantReadWriteLock, Integer>();
  +      Map distribution = new HashMap();
  +
  +      //Commented for JDK 1.4 use.
  +      //for (Fqn f : fqns)
  +      Iterator fqnsIterator = fqns.iterator();
  +      while (fqnsIterator.hasNext())
         {
  -         ReentrantReadWriteLock lock = stripedLock.getLock(f);
  +         ReentrantReadWriteLock lock = stripedLock.getLock((Fqn) fqnsIterator.next());
            if (distribution.containsKey(lock))
            {
  -            int count = distribution.get(lock) + 1;
  -            distribution.put(lock, count);
  +            int count = ((Integer) distribution.get(lock)).intValue() + 1;
  +            distribution.put(lock, new Integer(count));
            }
            else
            {
  -            distribution.put(lock, 1);
  +            distribution.put(lock, new Integer(1));
            }
         }
   
  @@ -50,9 +58,9 @@
         assertTrue(distribution.size() * 1.5 >= stripedLock.sharedLocks.length);
      }
   
  -   private List<Fqn> createRandomFqns(int number)
  +   private List createRandomFqns(int number)
      {
  -      List<Fqn> f = new ArrayList<Fqn>(number);
  +      List f = new ArrayList(number);
         Random r = new Random();
   
         while (f.size() < number)
  
  
  



More information about the jboss-cvs-commits mailing list