We'll use a ConcurrentHashMap for the bin, and then the enumerator will make a copy of it for returning.
This commit is contained in:
@@ -22,6 +22,7 @@ package com.samskivert.depot;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -127,7 +128,8 @@ public class EHCacheAdapter
|
|||||||
if (bin == null) {
|
if (bin == null) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// let's return a simple copy of the bin's fancy concurrent hashset
|
||||||
return Sets.newHashSet(bin.getKeys());
|
return Sets.newHashSet(bin.getKeys());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,8 +256,7 @@ public class EHCacheAdapter
|
|||||||
protected Ehcache _cache;
|
protected Ehcache _cache;
|
||||||
protected String _id;
|
protected String _id;
|
||||||
|
|
||||||
protected Set<Serializable> _keys = Collections.synchronizedSet(
|
protected Set<Serializable> _keys = Sets.newConcurrentHashSet();
|
||||||
Sets.<Serializable>newHashSet());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is just for convenience and memory use; we don't rely on pointer equality anywhere
|
// this is just for convenience and memory use; we don't rely on pointer equality anywhere
|
||||||
|
|||||||
Reference in New Issue
Block a user