private void startMonitoring(){
synchronized (this) {
    if (this.started) {
      return;
    }
    final boolean statListenerStarted=startCacheStatListener();
    if (!statListenerStarted) {
      startMemoryPoolPoller();
    }
    startJVMThresholdListener();
    this.started=true;
  }
}

private void startMonitoring ( ) { synchronized ( this ) { if ( this . started ) { return ; } final boolean statListenerStarted = startCacheStatListener ( ) ; if ( ! statListenerStarted ) { startMemoryPoolPoller ( ) ; } startJVMThresholdListener ( ) ; this . started = true ; } }
monitoring is done using a combination of data from the jvm and statistics collected from the cache . a usage threshold is set on the memorymxbean of the jvm to get notifications when the jvm crosses the eviction or critical thresholds . a separate usage collection is done either by setting up a listener on the cache stats or polling of the jvm , depending on whether stats have been enabled . this separate collection is done to return the state of the heap memory back to a normal state when memory has been freed .
