[
http://jira.jboss.com/jira/browse/JBCACHE-1288?page=comments#action_12401803 ]
Manik Surtani commented on JBCACHE-1288:
----------------------------------------
From your comments in the code:
// APPROACH 1: Scan for a default region, try to add if not there.
// This will try to add the region if it is missing but seems to break
// some unit tests that configure one or more non-default regions and
// no default region (e.g. the eviction.minttl tests). So, doing this
// seems to add a new semantic. For now comment this out and use APPROACH 2
// APPROACH 2: Only add a default region if there are no regions. This is
// contrary to the idea that there *must* be a default region, but some
// unit tests fail w/ APPROACH 1, so for now we go with this approach.
I think approach 2 is more "correct", at least until we formally define
somewhere that a default eviction region is *required* before you can define more eviction
regions. I.e., what if I want to configure a cache with no eviction, eith the exception
of a specific region? Your NullEvictionPolicy does explicitly take care of this but this
is a recent addition and I fear people may already be relying on behaviour that allows not
configuring a default eviction region.
Handling of default eviction region config leads to duplicates
--------------------------------------------------------------
Key: JBCACHE-1288
URL:
http://jira.jboss.com/jira/browse/JBCACHE-1288
Project: JBoss Cache
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Eviction
Affects Versions: 2.1.0.CR3
Reporter: Brian Stansberry
Assigned To: Manik Surtani
Fix For: 2.1.0.GA
The way the EvictionConfig.getEvictionRegionConfigs() method works leads to duplicate
entries for the _default_ region when the JBoss Microcontainer builds up a
configuration.
Problem is when there is no list of ERCs, the method builds one with a config for the
_default_ region in it, and returns that. The MC will call this method, and then try to
add xml-configured ERCs to the returned list. If a _default_ region is configured in XML,
the _default_ region will end up being in the resulting list twice.
Test org.jboss.cache.config.EvictionRegionConfigurationTest.testDuplicateDefaultRegion()
shows the issue.
I think the core problem here is that the attempt to add a default region is being done
in the wrong place. It's not really the concern of the EvictionConfig class. I think
it properly belongs in RegionManager.setEvictionConfig() -- that's the class
that's responsible for checking the configuration and making it conform to its
requirements.
I've got a patch along the above lines.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira