[jbosscache-commits] JBoss Cache SVN: r4885 - core/trunk/src/main/java/org/jboss/cache/lock.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Dec 19 12:49:35 EST 2007


Author: manik.surtani at jboss.com
Date: 2007-12-19 12:49:35 -0500 (Wed, 19 Dec 2007)
New Revision: 4885

Modified:
   core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java
Log:
Reverted back to using a concurrent hash set

Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java	2007-12-19 17:40:14 UTC (rev 4884)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java	2007-12-19 17:49:35 UTC (rev 4885)
@@ -6,10 +6,11 @@
  */
 package org.jboss.cache.lock;
 
+import org.jboss.cache.util.concurrent.ConcurrentHashSet;
+
 import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.Set;
 
 /**
  * Provide lock ownership mapping.
@@ -26,7 +27,9 @@
    private Object writeOwner_ = null;
 
    // This is more efficient (lower CPU utilisation and better concurrency) than a CopyOnWriteArraySet or ConcurrentHashSet.
-   private final List<Object> readOwnerList_ = Collections.synchronizedList(new LinkedList<Object>());
+   // for some reason this barfs with concurrent mod exceptions.  Need to see why.
+   // private final List<Object> readOwnerList_ = Collections.synchronizedList(new LinkedList<Object>());
+   private final Set<Object> readOwnerList_ = new ConcurrentHashSet<Object>();
 
    /**
     * Check whether this owner has reader or writer ownership.
@@ -114,7 +117,8 @@
     */
    public Collection<Object> readerOwners()
    {
-      return Collections.unmodifiableList(readOwnerList_);
+      //return Collections.unmodifiableList(readOwnerList_);
+      return Collections.unmodifiableSet(readOwnerList_);
    }
 
    public void releaseReaderOwners(LockStrategy lock)




More information about the jbosscache-commits mailing list