We need to guard against simultaneous calls to getCache().
This commit is contained in:
@@ -106,25 +106,26 @@ public class EHCacheAdapter
|
|||||||
|
|
||||||
protected EHCacheBin (String id)
|
protected EHCacheBin (String id)
|
||||||
{
|
{
|
||||||
_cache = _cachemgr.getCache(id);
|
synchronized (_cachemgr) {
|
||||||
if (_cache == null) {
|
_cache = _cachemgr.getCache(id);
|
||||||
// create the cache programatically with reasonable settings
|
if (_cache == null) {
|
||||||
// TODO: we will eventually need this to be configurable in .properties
|
// create the cache programatically with reasonable settings
|
||||||
|
// TODO: we will eventually need this to be configurable in .properties
|
||||||
|
_cache = new Cache(id,
|
||||||
|
5000, // keep 5000 elements in RAM
|
||||||
|
true, // overflow the rest to disk
|
||||||
|
false, // don't keep records around eternally
|
||||||
|
600, // keep them for 10 minutes after they're created
|
||||||
|
60); // or 1 minute after last access
|
||||||
|
|
||||||
_cache = new Cache(id,
|
if (_distributed) {
|
||||||
5000, // keep 5000 elements in RAM
|
// a programatically created cache has to have its replicator event
|
||||||
true, // overflow the rest to disk
|
// listener programatically added.
|
||||||
false, // don't keep records around eternally
|
_cache.getCacheEventNotificationService().registerListener(
|
||||||
600, // but do keep them for 10 minutes after they're created
|
new RMIAsynchronousCacheReplicator(true, true, true, true, 1000));
|
||||||
60); // or 1 minute after last access
|
}
|
||||||
|
_cachemgr.addCache(_cache);
|
||||||
if (_distributed) {
|
|
||||||
// a programatically created cache has to have its replicator event listener
|
|
||||||
// programatically added.
|
|
||||||
_cache.getCacheEventNotificationService().registerListener(
|
|
||||||
new RMIAsynchronousCacheReplicator(true, true, true, true, 1000));
|
|
||||||
}
|
}
|
||||||
_cachemgr.addCache(_cache);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user