• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • drb
  • Reporter: dhreines
  • May 11, 2010
  • 0
  • Watchers: 0
  • July 27, 2012
  • May 12, 2010

Attachments

Description

I’m trying to use ExplicitLockingCache as a cache decorator. However, it’s throwing an exception stating “Cannot replace It does not equal the incumbent cache." Looking into the code, it looks like it's a matter of implementing equals() on ExplicitLockingCache. Not sure if it's intended to be used as a decorator, but it works nicely in some scenarios. Prevents the user having to create a new instance of the cache each time it's retrieved via the CacheManager.

I’ve attached a proposed patch and test case. The changes were to override equals() and hashCode() on ExplicitLockingCache by delegating to the underlying cache instance. I’ve tested the changes locally and it seems to work.

The changes were created from the explicitlocking-0.2 tag.

Comments

gluck 2010-05-12

Hi. I added a test to the explicitlocking very similar to yours which passes with the current code.

I checked you test. It also passes on trunk.

So this is a solved problem in version 0.3

It would be great if you can sign a Contributor Agreement - See http://gregluck.com/blog/archives/2010/01/how-to-contribute-to-ehcache/ for the details. That way I can simply accept your code.

gluck 2010-05-12

Fixed in 0.3