@SuppressWarnings("rawtypes") protected static Region createRegion(Cache cache, RegionShortcut shortcut, String name) { return cache.createRegionFactory(shortcut).setEnableOffHeapMemory(true).create(name); }
public void run() { OutOfOffHeapMemoryDUnitTest.cache.set(getCache()); OutOfOffHeapMemoryDUnitTest.system.set(getSystem()); Region<Object, Object> region = OutOfOffHeapMemoryDUnitTest.cache.get(). createRegionFactory(shortcut).setEnableOffHeapMemory(true).create(name); assertNotNull(region); } });
@SuppressWarnings({ "rawtypes", "deprecation" }) @Override protected RegionFactory<?, ?> defineRegionFactory() { return new RegionFactory() .setPartitionAttributes(definePartitionAttributes()) .setEnableOffHeapMemory(true); } }
@Override public void run2() throws CacheException { Properties properties = new Properties(); properties.put(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "2m"); getSystem(properties); GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); regionFactory.setEnableOffHeapMemory(true); Region region = regionFactory.create(regionName); assertNotNull("Region is null", region); assertNotNull("Cache does not contain region", cache.getRegion(regionName)); } });
/** * Creates an off-heap region. * @param name a region name. * @param dataPolicy a data policy. * @return the newly created region. */ protected Region createOffHeapRegion(String name,DataPolicy dataPolicy) { return getCache().createRegionFactory().setEnableOffHeapMemory(true).setDataPolicy(dataPolicy).create(name); }
@Override public void run2() throws CacheException { Properties properties = new Properties(); properties.put(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "2m"); getSystem(properties); GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); regionFactory.setEnableOffHeapMemory(true); Region region = regionFactory.create(regionName); assertNotNull("Region is null", region); assertNotNull("Cache does not contain region", cache.getRegion(regionName)); } });
@Override public void run2() throws CacheException { Properties properties = new Properties(); properties.put(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "2m"); getSystem(properties); GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); regionFactory.setEnableOffHeapMemory(true); Region region = regionFactory.create(regionName); assertNotNull("Region is null", region); assertNotNull("Cache does not contain region", cache.getRegion(regionName)); } });
/** * 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().setDataPolicy(DataPolicy.REPLICATE).setCompressor(compressor).setEnableOffHeapMemory(offHeap).create(name); } }
/** * Creates and returns the test region. * @param concurrencyChecksEnabled concurrency checks will be enabled if true. */ protected Region<Object,Object> createRegion(boolean concurrencyChecksEnabled) { return getCache().createRegionFactory(getRegionShortcut()).setEnableOffHeapMemory(true).setConcurrencyChecksEnabled(concurrencyChecksEnabled).create(getRegionName()); }
public void initNoEvictRegion() { Cache cache = CacheHelper.getCache(); RegionFactory factory = ((GemFireCacheImpl) cache).createRegionFactory(RegionShortcut.LOCAL); factory.setEnableOffHeapMemory(isOffHeap()); final EvictionAttributesImpl evictionAttrs = new EvictionAttributesImpl(); evictionAttrs.setAlgorithm(EvictionAlgorithm.NONE); factory.setEvictionAttributes(evictionAttrs); noEvictRegion = factory.create("noEvictRegion"); }
@Override public void run2() throws CacheException { Properties properties = new Properties(); properties.put(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "2m"); getSystem(properties); GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); regionFactory.setEnableOffHeapMemory(true); Region region = regionFactory.create(offHeapRegionName); assertNotNull("Region is null", region); assertNotNull("Cache does not contain region", cache.getRegion(offHeapRegionName)); regionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); regionFactory.create(onHeapRegionName); assertNotNull("Region is null", region); assertNotNull("Cache does not contain region", cache.getRegion(onHeapRegionName)); } });
/** * 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); } }
@Override protected Region<Integer, String> createRegion(String regionName) { RegionFactory<Integer, String> rf = cache.createRegionFactory(RegionShortcut.PARTITION_HDFS); PartitionAttributes prAttr = new PartitionAttributesFactory().setTotalNumBuckets(10).create(); rf.setPartitionAttributes(prAttr); rf.setEnableOffHeapMemory(true); rf.setHDFSStoreName(hdfsStore.getName()); Region<Integer, String> r = rf.create(regionName); // addListener(r); ((PartitionedRegion) r).setQueryHDFS(true); return r; } @Override
@Override protected Region<Integer, String> createRegion(String regionName) { RegionFactory<Integer, String> rf = cache.createRegionFactory(RegionShortcut.PARTITION_HDFS); PartitionAttributes prAttr = new PartitionAttributesFactory().setTotalNumBuckets(10).create(); rf.setPartitionAttributes(prAttr); rf.setEnableOffHeapMemory(true); rf.setHDFSStoreName(hdfsStore.getName()); Region<Integer, String> r = rf.create(regionName); // addListener(r); ((PartitionedRegion) r).setQueryHDFS(true); return r; } @Override
public void run() { Cache cache = getCache(); PoolFactory pf = PoolManager.createFactory(); pf.addServer(getServerHostName(host), port); pf.setSubscriptionEnabled(true); pf.create(name); RegionFactory rf = new RegionFactory(); rf.setEnableOffHeapMemory(isOffHeapEnabled()); rf.setScope(Scope.LOCAL); rf.setPoolName(name); Region region = rf.create(name); region.registerInterest("ALL_KEYS"); } });
public void run() { Cache cache = getCache(); RegionFactory rf = new RegionFactory(); rf.setEnableOffHeapMemory(isOffHeapEnabled()); rf.setDataPolicy(DataPolicy.PARTITION); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(1); paf.setTotalNumBuckets(5); rf.setPartitionAttributes(paf.create()); rf.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1)); rf.setConcurrencyChecksEnabled(false); rf.create(name); } });
public void run() { Cache cache = getCache(); RegionFactory rf = new RegionFactory(); rf.setEnableOffHeapMemory(isOffHeapEnabled()); rf.setDataPolicy(DataPolicy.PARTITION); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(1); paf.setTotalNumBuckets(5); paf.setLocalMaxMemory(0); rf.setPartitionAttributes(paf.create()); rf.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1)); rf.setConcurrencyChecksEnabled(false); if(allContent) { // rf.initCacheListeners(new CacheListener [] { new MyListener()}); rf.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); } rf.create(name); } });
public void testSimpleOutOfOffHeapMemoryMemberDisconnects() { final Cache cache = getCache(); final DistributedSystem system = getSystem(); Region<Object, Object> region = cache.createRegionFactory(getRegionShortcut()).setEnableOffHeapMemory(true).create(getRegionName()); OutOfOffHeapMemoryException ooohme; try {
Region<Object, Object> region = this.cache.createRegionFactory(getRegionShortcut()).setEnableOffHeapMemory(true).create(getRegionName());
regionFactory.setEnableOffHeapMemory(true); final EvictionAttributesImpl evictionAttrs = new EvictionAttributesImpl(); evictionAttrs.setAlgorithm(EvictionAlgorithm.NONE);