@Override public void stop() { Collection<FilteringListenerInvocation<?, ?>> invocations = filteringInvocations.values(); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryActivated.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryCreated.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryInvalidated.class) .removeAll(invocations); cacheNotifier.getListenerCollectionForAnnotation(CacheEntryLoaded.class).removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryModified.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryPassivated.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryRemoved.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryVisited.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntriesEvicted.class) .removeAll(invocations); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryExpired.class) .removeAll(invocations); filteringInvocations.clear(); }
private void addFilteringInvocationForMatcher(Matcher matcher) { if (!filteringInvocations.containsKey(matcher)) { FilteringListenerInvocation filteringInvocation = new FilteringListenerInvocation(matcher); if (filteringInvocations.putIfAbsent(matcher, filteringInvocation) == null) { // todo these are added but never removed until stop is called cacheNotifier .getListenerCollectionForAnnotation(CacheEntryActivated.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryCreated.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryInvalidated.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryLoaded.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryModified.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryPassivated.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryRemoved.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryVisited.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntriesEvicted.class) .add(filteringInvocation); cacheNotifier .getListenerCollectionForAnnotation(CacheEntryExpired.class) .add(filteringInvocation); } } }