protected void cacheWriterChanged(CacheWriter oldWriter) {
    readWriteLockForCacheWriter.readLock().lock();
    try {
      if (cacheWriter != oldWriter) {
        closeCacheCallback(oldWriter);
      }
    } finally {
      readWriteLockForCacheWriter.readLock().unlock();
    }
  }
Called if when we go from no listeners to at least one or from at least one to no listeners

@param nowHasListener true if we now have at least one listener; false if we now have no
       listeners
geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java