private void onClose() { InternalResourceManager irm = this.cache.getResourceManager(false); if (irm != null) { irm.removeResourceListener(ResourceType.HEAP_MEMORY, this); } this.cache.removeDiskStore(this); }
/** * Get the percentage of heap at or above which the cache is considered in * danger of becoming inoperable. * * @return either the current or recently used percentage of the maximum * tenured heap * @see #SET_CRITICAL_HEAP_PERCENTAGE(float) */ public static float GET_CRITICAL_HEAP_PERCENTAGE() { return Misc.getGemFireCache().getResourceManager() .getCriticalHeapPercentage(); }
public static void setEvictionPercentage(final float percentage) { if (isOffHeap()) { GemFireCacheImpl.getInstance().getResourceManager().setEvictionOffHeapPercentage(percentage); } GemFireCacheImpl.getInstance().getResourceManager().setEvictionHeapPercentage(percentage); }
public Object call() throws Exception { TestMemoryThresholdListener listener = new TestMemoryThresholdListener(); InternalResourceManager irm = ((GemFireCacheImpl)getCache()).getResourceManager(); irm.addResourceListener(ResourceType.HEAP_MEMORY, listener); assertTrue(irm.getResourceListeners(ResourceType.HEAP_MEMORY).contains(listener)); return null; } });
public static GfxdHeapThresholdListener createInstance(GemFireCacheImpl cache) { final GfxdHeapThresholdListener listener = new GfxdHeapThresholdListener(cache); cache.getResourceManager().addResourceListener(ResourceType.HEAP_MEMORY, listener); if (GemFireXDUtils.TraceHeapThresh) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_HEAPTHRESH, "GfxdHeapThreshold: queryCancellationTimeInterval = " + queryCancellationTimeInterval); } return listener; }
public static GfxdHeapThresholdListener createInstance(GemFireCacheImpl cache) { final GfxdHeapThresholdListener listener = new GfxdHeapThresholdListener(cache); cache.getResourceManager().addResourceListener(ResourceType.HEAP_MEMORY, listener); if (GemFireXDUtils.TraceHeapThresh) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_HEAPTHRESH, "GfxdHeapThreshold: queryCancellationTimeInterval = " + queryCancellationTimeInterval); } return listener; }
public long getBytesUsed() { if (isOffHeap()) { return GemFireCacheImpl.getInstance().getResourceManager().getOffHeapMonitor().getBytesUsed(); } return GemFireCacheImpl.getInstance().getResourceManager().getHeapMonitor().getBytesUsed(); }
public Object call() throws Exception { InternalResourceManager irm = ((GemFireCacheImpl)getCache()).getResourceManager(); assertEquals(0, irm.getStats().getEvictionStartEvents()); assertEquals(0, irm.getStats().getHeapCriticalEvents()); assertEquals(0, irm.getStats().getCriticalThreshold()); assertEquals(0, irm.getStats().getEvictionThreshold()); return null; } });
public void scheduleCreateMissingBuckets() { if (this.prRegion.getColocatedWith() != null && ColocationHelper .isColocationComplete(this.prRegion)) { Runnable task = new CreateMissingBucketsTask(this); final InternalResourceManager resourceManager = this.prRegion .getGemFireCache().getResourceManager(); resourceManager.getExecutor().submit(task); } }
public static void SET_EVICTION_OFFHEAP_PERCENTAGE(float offHeapPercentage) throws StandardException { final InternalResourceManager rmgr = Misc.getGemFireCache() .getResourceManager(); rmgr.setEvictionOffHeapPercentage(offHeapPercentage); SanityManager.DEBUG_PRINT("info:" + GfxdConstants.TRACE_SYS_PROCEDURES, "configured eviction off heap percentage to " + rmgr.getEvictionOffHeapPercentage()); }
public static void SET_CRITICAL_OFFHEAP_PERCENTAGE(float offHeapPercentage) throws StandardException { final InternalResourceManager rmgr = Misc.getGemFireCache() .getResourceManager(); rmgr.setCriticalOffHeapPercentage(offHeapPercentage); SanityManager.DEBUG_PRINT("info:" + GfxdConstants.TRACE_SYS_PROCEDURES, "configured critical off heap percentage to " + rmgr.getCriticalOffHeapPercentage()); }
public static void SET_EVICTION_OFFHEAP_PERCENTAGE(float offHeapPercentage) throws StandardException { final InternalResourceManager rmgr = Misc.getGemFireCache() .getResourceManager(); rmgr.setEvictionOffHeapPercentage(offHeapPercentage); SanityManager.DEBUG_PRINT("info:" + GfxdConstants.TRACE_SYS_PROCEDURES, "configured eviction off heap percentage to " + rmgr.getEvictionOffHeapPercentage()); }
public static void SET_EVICTION_OFFHEAP_PERCENTAGE(float offHeapPercentage) throws StandardException { final InternalResourceManager rmgr = Misc.getGemFireCache() .getResourceManager(); rmgr.setEvictionOffHeapPercentage(offHeapPercentage); SanityManager.DEBUG_PRINT("info:" + GfxdConstants.TRACE_SYS_PROCEDURES, "configured eviction off heap percentage to " + rmgr.getEvictionOffHeapPercentage()); }
public void testPutsLocalRegion() throws Exception{ AttributesFactory attr = new AttributesFactory(); attr.setScope(Scope.LOCAL); Region region = cache.createRegion("localRegion", attr.create()); checkOpRejection(region, false, true); region.close(); assertEquals(0 + SYSTEM_LISTENERS, cache.getResourceManager(false). getResourceListeners(ResourceType.HEAP_MEMORY).size()); }
public void testTxDistributedRegion() throws Exception { AttributesFactory attr = new AttributesFactory(); attr.setScope(Scope.DISTRIBUTED_ACK); Region region = cache.createRegion("DistributedRegion", attr.create()); checkOpRejection(region, true, true); region.close(); assertEquals(0 + SYSTEM_LISTENERS, cache.getResourceManager(false). getResourceListeners(ResourceType.HEAP_MEMORY).size()); }
public void testPutsRejectedSubRegion() throws Exception { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); Region subRegion = cache.createRegion("local1", factory.create()) .createSubregion("sub1", factory.create()); checkOpRejection(subRegion, false, true); subRegion.close(); assertEquals(1 + SYSTEM_LISTENERS, cache.getResourceManager(false). getResourceListeners(ResourceType.HEAP_MEMORY).size()); //root region is still present }
public void testTxSubRegion() throws Exception { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); Region subRegion = cache.createRegion("local1", factory.create()) .createSubregion("sub1", factory.create()); checkOpRejection(subRegion, true, true); subRegion.close(); assertEquals(1 + SYSTEM_LISTENERS, cache.getResourceManager(false). getResourceListeners(ResourceType.HEAP_MEMORY).size()); //root region is still present }
public Object call() throws Exception { getCache().getLoggerI18n().fine(addExpectedBelow); HeapMemoryMonitor.setTestBytesUsedForThresholdSet(850); ((GemFireCacheImpl)getCache()).getResourceManager().getHeapMonitor().updateStateAndSendEvent(850); getCache().getLoggerI18n().fine(removeExpectedBelow); return null; } });
public Object call() throws Exception { getCache().getLoggerI18n().fine(addExpectedExString); ((GemFireCacheImpl)getCache()).getResourceManager().getHeapMonitor().updateStateAndSendEvent(950); HeapMemoryMonitor.setTestBytesUsedForThresholdSet(950); getCache().getLoggerI18n().fine(removeExpectedExString); return null; } });
public static void goCritical(GemFireCacheImpl cache) { InternalResourceManager irm = (InternalResourceManager)cache.getResourceManager(); getTestInstance().inspector.expectLowMemoryException(true, cache.getMyId()); if (isOffHeap()) { irm.getOffHeapMonitor().updateStateAndSendEvent(950); } else { irm.getHeapMonitor().updateStateAndSendEvent(950); } Log.getLogWriter().info("ThresholdsTest: Artifically moved into Critical State"); }