Author: manik.surtani(a)jboss.com
Date: 2007-10-29 07:21:34 -0400 (Mon, 29 Oct 2007)
New Revision: 4702
Modified:
core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java
Log:
Use a better concurrent 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-10-29 09:46:58 UTC
(rev 4701)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockMap.java 2007-10-29 11:21:34 UTC
(rev 4702)
@@ -6,9 +6,10 @@
*/
package org.jboss.cache.lock;
+import org.jboss.cache.util.concurrent.ConcurrentHashSet;
+
import java.util.Collections;
import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
/**
* Provide lock ownership mapping.
@@ -24,14 +25,13 @@
private Object writeOwner_ = null;
- // a CopyOnWriteArraySet is HUGELY inefficient since MANY LockMaps are created and are
frequently read from. Until we have a better impl ...
- private final Set<Object> readOwnerList_ = new
CopyOnWriteArraySet<Object>();
+ // This is more efficient (lower CPU utilisation and better concurrency) than a
CopyOnWriteArraySet.
+ private final Set<Object> readOwnerList_ = new
ConcurrentHashSet<Object>();
public LockMap()
{
}
-
/**
* Check whether this owner has reader or writer ownership.
*
Show replies by date