public <K, V> Region<K, V> createRegion(Cache c, String diskStore, RegionType type, String name) {
Region<Integer, MyObject> r = c.getRegion(name);
switch (type) {
case REPLICATE:
return c.<K, V>createRegionFactory(RegionShortcut.REPLICATE).create(name);
case REPLICATE_PERSISTENT:
return c.<K, V>createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT)
.setDiskStoreName(diskStore).create(name);
case REPLICATE_PERSISTENT_OVERFLOW:
return c.<K, V>createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT_OVERFLOW)
.setEvictionAttributes(
EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK))
.setDiskStoreName(diskStore).create(name);
case PARTITION:
return c.<K, V>createRegionFactory(RegionShortcut.PARTITION).create(name);
case PARTITION_PERSISTENT:
return c.<K, V>createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
.setDiskStoreName(diskStore).create(name);
case PARTITION_PERSISTENT_OVERFLOW:
return c.<K, V>createRegionFactory(RegionShortcut.PARTITION_PERSISTENT_OVERFLOW)
.setEvictionAttributes(
EvictionAttributes.createLIFOEntryAttributes(5, EvictionAction.OVERFLOW_TO_DISK))
.setDiskStoreName(diskStore).create(name);
}
throw new IllegalArgumentException();
}