SGF-166 fixed region parser for close attribute

This commit is contained in:
David Turanski
2013-03-08 15:07:53 -05:00
parent e3a6f47e76
commit 934911a142
4 changed files with 12 additions and 21 deletions

View File

@@ -250,47 +250,33 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
if (!region.getRegionService().isClosed()) {
try {
region.close();
region = null;
} catch (CacheClosedException cce) {
// nothing to see folks, move on.
}
}
} else if (destroy) {
} if (destroy) {
region.destroyRegion();
region = null;
}
}
region = null;
}
/**
* Indicates whether the region referred by this factory bean, will be
* destroyed on shutdown (default false). Note: destroy and close are
* mutually exclusive. Enabling one will automatically disable the other.
*
* @param destroy whether or not to destroy the region
*
* @see #setClose(boolean)
* destroyed on shutdown (default false).
*/
public void setDestroy(boolean destroy) {
this.destroy = destroy;
if (destroy) {
close = false;
}
}
/**
* Indicates whether the region referred by this factory bean, will be
* closed on shutdown (default true). Note: destroy and close are mutually
* exclusive. Enabling one will automatically disable the other.
*
* @param close whether to close or not the region
* @see #setDestroy(boolean)
* closed on shutdown (default true).
*/
public void setClose(boolean close) {
this.close = close;
if (close) {
destroy = false;
}
}
/**

View File

@@ -98,9 +98,12 @@ abstract class AbstractRegionParser extends AliasReplacingBeanDefinitionParser {
String cacheRef = element.getAttribute("cache-ref");
// add cache reference (fallback to default if nothing is specified)
builder.addPropertyReference("cache", (StringUtils.hasText(cacheRef) ? cacheRef : GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME));
ParsingUtils.setPropertyValue(element, builder, "close");
ParsingUtils.setPropertyValue(element, builder, "destroy");
}
// add attributes
ParsingUtils.setPropertyValue(element, builder, "name");
ParsingUtils.parseOptionalRegionAttributes(parserContext, element, attrBuilder);
ParsingUtils.parseStatistics(element, attrBuilder);
ParsingUtils.setPropertyValue(element, attrBuilder, "publisher");