Hi,
small bug which we found while test driving Cache2k with JMX enabled in JEE application server.
Version: Running 1.2.1.Final
Scenario:
We want to change the default cache manager name for the current application before any cache is accessed.
Expectation:
Calling CacheManager.setDefaultName early will register the given name.
Observation:
An UnsupportedOperationException is thrown, coming out of EmptyMap/AbstractMap.put.
Reason:
Cache2kCoreProviderImpl initializes loader2defaultName with Collection.emptyMap. This map implementation is immutable and therefore the put modification done in Cache2kCoreProviderImpl.setDefaultManagerName fails.
The field is overwritten with a WeakHashMap as soon as getDefaultManagerName is called but then we're not allowed to change the cache manager name anymore.
Workaround:
Setting the cache manager name via XML works as desired.
Hi,
small bug which we found while test driving Cache2k with JMX enabled in JEE application server.
Version: Running
1.2.1.FinalScenario:
We want to change the default cache manager name for the current application before any cache is accessed.
Expectation:
Calling
CacheManager.setDefaultNameearly will register the given name.Observation:
An
UnsupportedOperationExceptionis thrown, coming out ofEmptyMap/AbstractMap.put.Reason:
Cache2kCoreProviderImplinitializesloader2defaultNamewithCollection.emptyMap. This map implementation is immutable and therefore theputmodification done inCache2kCoreProviderImpl.setDefaultManagerNamefails.The field is overwritten with a
WeakHashMapas soon asgetDefaultManagerNameis called but then we're not allowed to change the cache manager name anymore.Workaround:
Setting the cache manager name via XML works as desired.