Skip to content

Cannot set default manager name via CacheManager.setDefaultName #108

Description

@frederikb

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions