SGF-135: deleteAll() uses region.clear() if possible

This commit is contained in:
David Turanski
2012-10-17 05:56:58 -04:00
parent 321a964bb0
commit e97ab1d253
2 changed files with 37 additions and 4 deletions

View File

@@ -177,9 +177,13 @@ public class SimpleGemfireRepository<T, ID extends Serializable> implements Gemf
@Override
@SuppressWarnings("rawtypes")
public Void doInGemfire(Region region) {
for (Object key : region.keySet()) {
region.remove(key);
//clear() does not work for partitioned regions
try {
region.clear();
} catch (UnsupportedOperationException e) {
for (Object key : region.keySet()) {
region.remove(key);
}
}
return null;