From 1468275c185223ef161ed8811abf4da57a461f27 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 24 Apr 2009 23:19:18 +0000 Subject: [PATCH] Patch from Charlie to update to Google Collect rc1. --- src/java/com/samskivert/depot/EHCacheAdapter.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/java/com/samskivert/depot/EHCacheAdapter.java b/src/java/com/samskivert/depot/EHCacheAdapter.java index d8e9e45..0bf16bf 100644 --- a/src/java/com/samskivert/depot/EHCacheAdapter.java +++ b/src/java/com/samskivert/depot/EHCacheAdapter.java @@ -24,6 +24,7 @@ import java.io.Serializable; import java.util.Collections; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -62,7 +63,7 @@ public class EHCacheAdapter public Histogram removes; public Histogram enumerations; } - + /** * Creates an adapter using the supplied cache manager. Note: this adapter does not shut down * the supplied manager when it is shutdown. The caller is responsible for shutting down the @@ -127,7 +128,7 @@ public class EHCacheAdapter if (bin == null) { return Collections.emptySet(); } - + // let's return a simple copy of the bin's fancy concurrent hashset Set result = Sets.newHashSet(bin.getKeys()); _enumerations.addValue((int) (System.currentTimeMillis() - now)); @@ -137,10 +138,10 @@ public class EHCacheAdapter // from CacheAdapter public void shutdown () { - log.info("EHCacheAdapter shutting down", "lookups", _lookups, + log.info("EHCacheAdapter shutting down", "lookups", _lookups, "stores", _stores, "removes", _removes, "enumerations", _enumerations); } - + /** * Return a snapshot of the current histograms detailing how much time the different * operations lookup, store, remove and enumerate take. @@ -277,7 +278,8 @@ public class EHCacheAdapter protected Ehcache _cache; protected String _id; - protected Set _keys = Sets.newConcurrentHashSet(); + protected Set _keys = + Sets.newSetFromMap(new ConcurrentHashMap()); } // this is just for convenience and memory use; we don't rely on pointer equality anywhere