SGF-166 fixed region parser for close attribute
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user