SGF-189 - Can make local regions persistent

This commit is contained in:
David Turanski
2013-08-06 07:28:53 -04:00
parent cb45af775f
commit c303decbc5
3 changed files with 13 additions and 5 deletions

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.data.gemfire;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.Scope;
@@ -29,11 +31,6 @@ public class LocalRegionFactoryBean<K, V> extends RegionFactoryBean<K, V> {
throw new UnsupportedOperationException("setScope() is not allowed for Local Regions");
}
@Override
public void setPersistent(boolean persistent) {
throw new UnsupportedOperationException("setPersistent() is not allowed for Local Regions");
}
@Override
public void afterPropertiesSet() throws Exception {
super.setScope(Scope.LOCAL);
@@ -51,6 +48,7 @@ public class LocalRegionFactoryBean<K, V> extends RegionFactoryBean<K, V> {
regionFactory.setDataPolicy(DataPolicy.PRELOADED);
}
else if ("EMPTY".equals(dataPolicy)) {
Assert.isTrue(persistent == null || !persistent, "Cannot have persistence on an empty region");
regionFactory.setDataPolicy(DataPolicy.EMPTY);
}
else {