When we shutdown our EHCacheAdapter, go through and flush everything from
memory so that if we turn around and recreate a PersistenceContext with a brand new classloader and start loading things from the cache, we don't have freakoutery because there's a record in memory that was resolved with the old classloader. Plus it allows those old classloaders to get collected.
This commit is contained in:
@@ -140,6 +140,13 @@ public class EHCacheAdapter
|
|||||||
{
|
{
|
||||||
log.debug("EHCacheAdapter shutting down", "lookups", _lookups,
|
log.debug("EHCacheAdapter shutting down", "lookups", _lookups,
|
||||||
"stores", _stores, "removes", _removes, "enumerations", _enumerations);
|
"stores", _stores, "removes", _removes, "enumerations", _enumerations);
|
||||||
|
|
||||||
|
// go through and flush all of the caches we resolved
|
||||||
|
for (Ehcache cache : _categories.values()) {
|
||||||
|
cache.flush();
|
||||||
|
}
|
||||||
|
_categories.clear();
|
||||||
|
_bins.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user