public List<CacheEvent<K, V>> getEventHistory() {
    synchronized (lock) {
      if (eventHistory == null) {
        return Collections.emptyList();
      } else {
        List<CacheEvent<K, V>> result = eventHistory;
        eventHistory = new ArrayList<>();
        return result;
      }
    }
  }
Returns a copy of the list of events collected in this listener's history. Also clears the
current history.

@return a copy of the list of events collected in this listener's history
@since GemFire 5.0
geode-dunit/src/main/java/org/apache/geode/cache30/TestCacheListener.java