@Override
  public void notifyListeners(final Set<ResourceListener<?>> listeners,
      final ResourceEvent event) {
    for (ResourceListener listener : listeners) {
      try {
        listener.onEvent(event);
      } catch (CancelException ignore) {
        // ignore
      } catch (Throwable t) {
        Error err;
        if (t instanceof Error && SystemFailure.isJVMFailureError(err = (Error) t)) {
          SystemFailure.initiateFailure(err);
          // If this ever returns, rethrow the error. We're poisoned now, so
          // don't let this thread continue.
          throw err;
        }
        // Whenever you catch Error or Throwable, you must also
        // check for fatal JVM error (see above). However, there is
        // _still_ a possibility that you are dealing with a cascading
        // error condition, so you also need to check to see if the JVM
        // is still usable:
        SystemFailure.checkFailure();
        cache.getLogger()
            .error("Exception occurred when notifying listeners ", t);
      }
    }
  }
Deliver a memory event from one of the monitors to both local listeners and remote resource
managers. Also, if a critical event is received and a query monitor has been enabled, then the
query monitor will be notified.

Package private for testing.

@param event Event to process.
@param eventOrigin Indicates where the event originated e.g. notification vs polling
geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java