HeapMemoryMonitor implements NotificationListener, MemoryMonitor { public LowMemoryException createLowMemoryIfNeeded(Function function, DistributedMember targetMember) { Set<DistributedMember> targetMembers = Collections.singleton(targetMember); return createLowMemoryIfNeeded(function, targetMembers); } HeapMemoryMonitor(final InternalResourceManager resourceManager, final InternalCache cache,
      final ResourceManagerStats stats); static MemoryPoolMXBean getTenuredMemoryPoolMXBean(); void setMemoryStateChangeTolerance(int memoryStateChangeTolerance); int getMemoryStateChangeTolerance(); @Override void stopMonitoring(); static Statistics getTenuredPoolStatistics(StatisticsManager statisticsManager); @Override boolean hasEvictionThreshold(); void updateStateAndSendEvent(); void updateStateAndSendEvent(long bytesUsed, String eventOrigin); @Override void fillInProfile(final ResourceManagerProfile profile); @Override MemoryState getState(); @Override MemoryThresholds getThresholds(); @Override long getBytesUsed(); static long getTenuredPoolMaxMemory(); @Override void notifyListeners(final Set<ResourceListener> listeners, final ResourceEvent event); @Override void handleNotification(final Notification notification, final Object callback); void checkForLowMemory(Function function, DistributedMember targetMember); void checkForLowMemory(Function function, Set<? extends DistributedMember> dest); LowMemoryException createLowMemoryIfNeeded(Function function,
      DistributedMember targetMember); LowMemoryException createLowMemoryIfNeeded(Function function,
      Set<? extends DistributedMember> memberSet); boolean isMemberHeapCritical(final InternalDistributedMember member); @Override String toString(); void setTestMaxMemoryBytes(final long testMaxMemoryBytes); static void setTestDisableMemoryUpdates(final boolean newTestDisableMemoryUpdates); static void setTestBytesUsedForThresholdSet(final long newTestBytesUsedForThresholdSet); static final String POLLER_INTERVAL_PROP; }
@Test public void createLowMemoryIfNeededWithSetArg_ReturnsException() throws Exception { setMocking(true, false, memberSet); LowMemoryException exception = heapMonitor.createLowMemoryIfNeeded(function, memberSet); assertLowMemoryException(exception); }
@Test public void createLowMemoryIfNeededWithMemberArg_ReturnsException() throws Exception { setMocking(true, false, memberSet); LowMemoryException exception = heapMonitor.createLowMemoryIfNeeded(function, member); assertLowMemoryException(exception); }