EHC ❯ Race in CacheManager.replaceCacheWithDecoratedCache(Ehcache, Ehcache)
-
Bug
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
-
-
alexsnaps
-
Reporter: alexsnaps
-
April 09, 2010
-
0
-
Watchers: 0
-
July 15, 2010
-
June 16, 2010
Description
There is still a race condition in this method, where the replace isn’t actually checking for the Cache being replaced to still be the same instance. One solution I can think of is replacing the Map<String, Ehcache> ehcaches to have its values replaced by some CacheHolder that would properly override the Object.equals(Object): boolean to check for object identity when the ConcurrentMap.replace is actually being executed
Looks like this works actually. equals being based on the cache’s GUID and CacheManager.replaceCacheWithDecoratedCache does the replace. I even wrote a test for that, proving it did work… Probably forgot to close this…