/** * Creates a region and assigns a compressor. * * @param name * a region name. * @param compressor * a compressor. */ private Region createRegion(String name, Compressor compressor, boolean offHeap) { return getCache().<String, String> createRegionFactory() .addCacheListener(CACHE_LISTENER).setCacheWriter(CACHE_WRITER) .setDataPolicy(DataPolicy.REPLICATE).setCompressor(compressor) .setEnableOffHeapMemory(offHeap) .create(name); } }
public void testSetCacheWriter() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(REPLICATE_PROXY); CacheWriter cw = new MyCacheWriter(); r1 = factory.setCacheWriter(cw).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(cw, ra.getCacheWriter()); } finally { cleanUpRegion(r1); } }
if (cacheWriter != null) { Class<CacheWriter<K, V>> cacheWriterKlass = forName(cacheWriter, CliStrings.CREATE_REGION__CACHEWRITER); factory.setCacheWriter(newInstance(cacheWriterKlass, CliStrings.CREATE_REGION__CACHEWRITER));
if (cacheWriter != null) { Class<CacheWriter<K, V>> cacheWriterKlass = forName(cacheWriter, CliStrings.CREATE_REGION__CACHEWRITER); factory.setCacheWriter(newInstance(cacheWriterKlass, CliStrings.CREATE_REGION__CACHEWRITER));