PR: COLLECTIONS-334
Synchronizing access to locks in StaticBucketMap.size()


git-svn-id: 
https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH@1076039
 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/commons-collections/commit/470db289
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/470db289
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/470db289

Branch: refs/heads/COLLECTIONS_3_2_BRANCH
Commit: 470db289c3fead9f22444232ef28c1ec4c32dfe2
Parents: bcc68d4
Author: Jochen Wiedmann <joc...@apache.org>
Authored: Tue Mar 1 22:35:01 2011 +0000
Committer: Jochen Wiedmann <joc...@apache.org>
Committed: Tue Mar 1 22:35:01 2011 +0000

----------------------------------------------------------------------
 src/java/org/apache/commons/collections/map/StaticBucketMap.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/470db289/src/java/org/apache/commons/collections/map/StaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/StaticBucketMap.java 
b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
index 4a130c3..1a0d379 100644
--- a/src/java/org/apache/commons/collections/map/StaticBucketMap.java
+++ b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
@@ -182,7 +182,9 @@ public final class StaticBucketMap implements Map {
         int cnt = 0;
 
         for (int i = 0; i < buckets.length; i++) {
-            cnt += locks[i].size;
+            synchronized(locks[i]) {
+                cnt += locks[i].size;
+            }
         }
         return cnt;
     }

Reply via email to