use of org.apache.geode.internal.size.SizeClassOnceObjectSizer in project geode by apache.
the class CacheXmlGenerator method generate.
private void generate(EvictionAttributes ea) throws SAXException {
EvictionAction eAction = ea.getAction();
if (eAction.isNone()) {
return;
}
AttributesImpl atts = new AttributesImpl();
atts.addAttribute("", "", ACTION, "", eAction.toString());
handler.startElement("", EVICTION_ATTRIBUTES, EVICTION_ATTRIBUTES, EMPTY);
if (ea.getAlgorithm() == EvictionAlgorithm.LRU_ENTRY) {
atts.addAttribute("", "", MAXIMUM, "", String.valueOf(ea.getMaximum()));
handler.startElement("", LRU_ENTRY_COUNT, LRU_ENTRY_COUNT, atts);
handler.endElement("", LRU_ENTRY_COUNT, LRU_ENTRY_COUNT);
} else if (ea.getAlgorithm() == EvictionAlgorithm.LRU_MEMORY) {
atts.addAttribute("", "", MAXIMUM, "", String.valueOf(ea.getMaximum()));
handler.startElement("", LRU_MEMORY_SIZE, LRU_MEMORY_SIZE, atts);
ObjectSizer os = ea.getObjectSizer();
if (os != null && os != ObjectSizer.DEFAULT) {
generate((Declarable) os, false);
}
handler.endElement("", LRU_MEMORY_SIZE, LRU_MEMORY_SIZE);
} else if (ea.getAlgorithm() == EvictionAlgorithm.LRU_HEAP) {
handler.startElement("", LRU_HEAP_PERCENTAGE, LRU_HEAP_PERCENTAGE, atts);
if (this.version.compareTo(CacheXmlVersion.GEMFIRE_6_0) >= 0) {
ObjectSizer os = ea.getObjectSizer();
if (!(os instanceof SizeClassOnceObjectSizer)) {
if (os != null) {
generate((Declarable) os, false);
}
}
}
handler.endElement("", LRU_HEAP_PERCENTAGE, LRU_HEAP_PERCENTAGE);
} else {
// all other algos are ignored
}
handler.endElement("", EVICTION_ATTRIBUTES, EVICTION_ATTRIBUTES);
}
Aggregations