public void run2() throws CacheException { Region region = createRegion(name); // Put key2 in the region before any callbacks are // registered, so it can be destroyed later region.put(key2, value2); assertEquals(1, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); LocalRegion reRegion; reRegion = (LocalRegion) region; RegionEntry re = reRegion.getRegionEntry(key2); MemoryChunkWithRefCount mc = (MemoryChunkWithRefCount) re._getValue(); assertEquals(1, mc.getRefCount()); assertEquals(1, ma.getStats().getObjects()); } } };
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); region.put(key, oldValue, arg); assertEquals(2, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(2, ma.getStats().getObjects()); LocalRegion reRegion; reRegion = (LocalRegion) region; MemoryChunkWithRefCount mc = (MemoryChunkWithRefCount) reRegion.getRegionEntry(key)._getValue(); assertEquals(1, mc.getRefCount()); } } });
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); try { region.put(key, newValue, exception); fail("Should have thrown a CacheWriterException"); } catch (CacheWriterException ex) { Region.Entry entry = region.getEntry(key); assertEquals(oldValue, entry.getValue()); assertEquals(2, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(2, ma.getStats().getObjects()); LocalRegion reRegion; reRegion = (LocalRegion) region; MemoryChunkWithRefCount mc = (MemoryChunkWithRefCount) reRegion.getRegionEntry(key)._getValue(); assertEquals(1, mc.getRefCount()); } } } });