diff --git a/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java b/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java index e5f0cc2c..59cc6cbe 100644 --- a/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java @@ -136,7 +136,7 @@ public class RegionFactoryBean extends RegionLookupFactoryBean imple } } } - if (destroy) { + else if (destroy) { region.destroyRegion(); } } @@ -146,21 +146,33 @@ public class RegionFactoryBean extends RegionLookupFactoryBean imple /** * 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) */ 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) */ public void setClose(boolean close) { this.close = close; + if (close) { + destroy = false; + } } /** diff --git a/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd b/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd index fdfc4758..4aef42f1 100644 --- a/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd +++ b/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd @@ -210,6 +210,8 @@ After the destroy, this region object can not be used any more and any attempt t RegionDestroyedException. Default is false, meaning that regions are not destroyed. + +Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other. ]]> @@ -221,7 +223,8 @@ disk files. Additionally it notifies the listeners and callbacks. Default is true, meaning the regions are closed. -Note: Regions are automatically closed when cache closes. +Note: Regions are automatically closed when cache closes. +Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other. ]]>