A little more information in our paranoid logging.
This commit is contained in:
@@ -79,8 +79,9 @@ public class EHCacheAdapter
|
|||||||
long dT = System.currentTimeMillis() - now;
|
long dT = System.currentTimeMillis() - now;
|
||||||
if (dT > 50) {
|
if (dT > 50) {
|
||||||
log.warning("Aii! A simple ehcache lookup took over 50 ms!", "cacheId", cacheId,
|
log.warning("Aii! A simple ehcache lookup took over 50 ms!", "cacheId", cacheId,
|
||||||
"key", key, "dT", dT);
|
"key", key, "dT", dT, "lookups", _lookups);
|
||||||
}
|
}
|
||||||
|
_lookups ++;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +103,9 @@ public class EHCacheAdapter
|
|||||||
long dT = System.currentTimeMillis() - now;
|
long dT = System.currentTimeMillis() - now;
|
||||||
if (dT > 50) {
|
if (dT > 50) {
|
||||||
log.warning("Aii! A simple ehcache store took over 50 ms!", "cacheId", cacheId,
|
log.warning("Aii! A simple ehcache store took over 50 ms!", "cacheId", cacheId,
|
||||||
"key", key, "dT", dT);
|
"key", key, "dT", dT, "stores", _stores);
|
||||||
}
|
}
|
||||||
|
_stores ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from CacheAdapter
|
// from CacheAdapter
|
||||||
@@ -117,20 +119,29 @@ public class EHCacheAdapter
|
|||||||
long dT = System.currentTimeMillis() - now;
|
long dT = System.currentTimeMillis() - now;
|
||||||
if (dT > 50) {
|
if (dT > 50) {
|
||||||
log.warning("Aii! A simple ehcache remove took over 50 ms!", "cacheId", cacheId,
|
log.warning("Aii! A simple ehcache remove took over 50 ms!", "cacheId", cacheId,
|
||||||
"key", key, "dT", dT);
|
"key", key, "dT", dT, "removes", _removes);
|
||||||
}
|
}
|
||||||
|
_removes ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from CacheAdapter
|
// from CacheAdapter
|
||||||
public <T> Iterable<Serializable> enumerate (final String cacheId)
|
public <T> Iterable<Serializable> enumerate (final String cacheId)
|
||||||
{
|
{
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
EHCacheBin<?> bin = _bins.get(cacheId);
|
EHCacheBin<?> bin = _bins.get(cacheId);
|
||||||
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
|
// let's return a simple copy of the bin's fancy concurrent hashset
|
||||||
return Sets.newHashSet(bin.getKeys());
|
Set<Serializable> result = Sets.newHashSet(bin.getKeys());
|
||||||
|
long dT = System.currentTimeMillis() - now;
|
||||||
|
if (dT > 250) {
|
||||||
|
log.warning("Aii! A cache enumeration took over 250 ms!", "cacheId", cacheId,
|
||||||
|
"dT", dT, "enumerations", _enumerations);
|
||||||
|
}
|
||||||
|
_enumerations ++;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from CacheAdapter
|
// from CacheAdapter
|
||||||
@@ -171,6 +182,8 @@ public class EHCacheAdapter
|
|||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int _lookups, _stores, _removes, _enumerations;
|
||||||
|
|
||||||
protected Map<CacheCategory, Ehcache> _categories =
|
protected Map<CacheCategory, Ehcache> _categories =
|
||||||
Collections.synchronizedMap(Maps.<CacheCategory, Ehcache>newHashMap());
|
Collections.synchronizedMap(Maps.<CacheCategory, Ehcache>newHashMap());
|
||||||
protected Map<String, EHCacheBin<?>> _bins =
|
protected Map<String, EHCacheBin<?>> _bins =
|
||||||
|
|||||||
Reference in New Issue
Block a user