public void setCacheWriter(CacheWriter<K, V> cacheWriter) {
    regionAttributes.cacheWriter = cacheWriter;
    regionAttributes.setHasCacheWriter(true);
  }
Sets the cache writer for the next {@code RegionAttributes} created.

@param cacheWriter the cache writer or null if no cache writer
@throws IllegalStateException if this region has a {@link #setPoolName pool name set}
geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java