public final boolean isOffHeap() { final LocalRegion region = this.region; if (region != null) { return region.getEnableOffHeapMemory(); } return this.regionAttributes != null && this.regionAttributes.getEnableOffHeapMemory(); }
public final boolean isOffHeap() { final LocalRegion region = this.region; if (region != null) { return region.getEnableOffHeapMemory(); } return this.regionAttributes != null && this.regionAttributes.getEnableOffHeapMemory(); }
public final boolean isOffHeap() { final LocalRegion region = this.region; if (region != null) { return region.getEnableOffHeapMemory(); } return this.regionAttributes != null && this.regionAttributes.getEnableOffHeapMemory(); }
private static boolean isOffHeap() { return testInstance.aRegion.getAttributes().getEnableOffHeapMemory(); }
protected boolean includeLocalRegion(LocalRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && region.getAttributes().getEnableOffHeapMemory()); }
protected boolean includeLocalRegion(LocalRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && !region.getAttributes().getEnableOffHeapMemory()); }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); region.destroy(key, arg); assertEquals(1, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(1, ma.getStats().getObjects()); } } });
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && !region.getAttributes().getEnableOffHeapMemory()); }
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && region.getAttributes().getEnableOffHeapMemory()); }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); region.put(key, newValue, 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()); } } });
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); assertEquals(1, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(1, ma.getStats().getObjects()); } region.destroyRegion(arg); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(0, ma.getStats().getObjects()); } } });
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); try { region.put(key, oldValue, exception); fail("Should have thrown a CacheWriterException"); } catch (CacheWriterException ex) { assertNull(region.getEntry(key)); assertEquals(1, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(1, ma.getStats().getObjects()); } } } });
public void beforeRegionClear(Region rgn) { if (rgn.getAttributes().getEnableOffHeapMemory()) { if (rgn.getAttributes().getDataPolicy().isPartition()) { PartitionedRegion pr = (PartitionedRegion) rgn; int numBucketsHosted = pr.getRegionAdvisor().getAllBucketAdvisors() .size(); this.setNumExpectedRegionClearCalls(numBucketsHosted); } else { this.setNumExpectedRegionClearCalls(1); } } } }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); try { region.destroy(key, exception); fail("Should have thrown a CacheWriterException"); } catch (CacheWriterException ex) { assertNotNull(region.getEntry(key)); 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()); } } } });
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.destroyRegion(exception); fail("Should have thrown a CacheWriterException"); } catch (CacheWriterException ex) { if (region.isDestroyed()) { fail("should not have an exception if region is destroyed", ex); } assertEquals(1, region.size()); if (region.getAttributes().getEnableOffHeapMemory() && !(region instanceof PartitionedRegion)) { GemFireCacheImpl gfc = (GemFireCacheImpl) getCache(); SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) gfc.getOffHeapStore(); assertEquals(1, ma.getStats().getObjects()); } } } });
/** Get the current number of bytes in the region. * */ protected long getRegionSizeInBytes() { Region workRegion = getWorkRegion(); int numKeys = workRegion.keys().size(); CapConBB.getBB().getSharedCounters().setIfLarger(CapConBB.MAX_NUM_KEYS, numKeys); if (workRegion.getAttributes().getEnableOffHeapMemory()) { GemFireCacheImpl gfCache = (GemFireCacheImpl)(CacheUtil.getCache()); return gfCache.getOffHeapStore().getStats().getUsedMemory(); } else { return memLRUParams.getTotalBytesPerEntry() * numKeys; } }
@SuppressWarnings("rawtypes") public void testEnableOffHeapMemoryRootRegionWithoutOffHeapMemoryThrowsException() { final String regionName = getUniqueName(); final CacheCreation cache = new CacheCreation(); final RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableOffHeapMemory(true); assertEquals(true, attrs.getEnableOffHeapMemory()); final Region regionBefore = cache.createRegion(regionName, attrs); assertNotNull(regionBefore); assertEquals(true, regionBefore.getAttributes().getEnableOffHeapMemory()); try { testXml(cache); } catch (IllegalStateException e) { // expected String msg = "The region /" + regionName + " was configured to use off heap memory but no off heap memory was configured."; assertEquals(msg, e.getMessage()); } }
private boolean mustEvict() { if(callback.isSnappyStore()){ return this.sizeInVM() > 0; } LocalRegion owner = _getOwner(); InternalResourceManager resourceManager = owner.getCache().getResourceManager(); final boolean monitorStateIsEviction; if (!owner.getAttributes().getEnableOffHeapMemory()) { monitorStateIsEviction = resourceManager.getHeapMonitor().getState().isEviction(); } else { monitorStateIsEviction = resourceManager.getOffHeapMonitor().getState().isEviction(); } return monitorStateIsEviction && this.sizeInVM() > 0; }