public EvictionConfig parseEvictionElement(Element evictionElement)
{
assertNotLegacyElement(evictionElement);
EvictionConfig evictionConfig = new EvictionConfig();
String wakeUpInterval = getAttributeValue(evictionElement, "wakeUpInterval");
if (existsAttribute(wakeUpInterval))
{
evictionConfig.setWakeupInterval(getInt(wakeUpInterval));
}
else
{
throw new ConfigurationException("Missing mandatory attribute wakeUpInterval");
}
List<EvictionRegionConfig> evictionRegionConfigs = new LinkedList<EvictionRegionConfig>();
Element defaultRegion = getSingleElementInCoreNS("default", evictionElement);
if (defaultRegion != null)
{
EvictionRegionConfig defaultRegionConfig = getEvictionRegionConfig(defaultRegion, null, true);
if (defaultRegionConfig.getEvictionAlgorithmConfig() == null)
throw new MissingPolicyException("Default eviction region should have an evictionAlgorithmClass defined.");
evictionConfig.setDefaultEvictionRegionConfig(defaultRegionConfig);
}
NodeList regions = evictionElement.getElementsByTagName("region");
for (int i = 0; i < regions.getLength(); i++)
{
Element regionConfig = (Element) regions.item(i);
EvictionRegionConfig erc = getEvictionRegionConfig(regionConfig, evictionConfig.getDefaultEvictionRegionConfig(), false);
evictionConfig.applyDefaults(erc);
evictionRegionConfigs.add(erc);
}
evictionConfig.setEvictionRegionConfigs(evictionRegionConfigs);
return evictionConfig;
}