use of org.apache.jackrabbit.oak.plugins.observation.filter.EventFilter in project jackrabbit-oak by apache.
the class ChangeProcessor method contentChanged.
@Override
public void contentChanged(@Nonnull NodeState before, @Nonnull NodeState after, @Nonnull CommitInfo info) {
// OAK-5160 before is now guaranteed to be non-null
checkNotNull(before);
checkNotNull(after);
checkNotNull(info);
try {
long start = PERF_LOGGER.start();
FilterProvider provider = filterProvider.get();
// FIXME don't rely on toString for session id
if (provider.includeCommit(contentSession.toString(), info)) {
EventFilter filter = provider.getFilter(before, after);
EventIterator events = new EventQueue(namePathMapper, info, before, after, provider.getSubTrees(), Filters.all(filter, VISIBLE_FILTER), provider.getEventAggregator());
long time = System.nanoTime();
boolean hasEvents = events.hasNext();
tracker.recordProducerTime(System.nanoTime() - time, TimeUnit.NANOSECONDS);
if (hasEvents && runningMonitor.enterIf(running)) {
if (commitRateLimiter != null) {
commitRateLimiter.beforeNonBlocking();
}
try {
CountingIterator countingEvents = new CountingIterator(events);
eventListener.onEvent(countingEvents);
countingEvents.updateCounters(eventCount, eventDuration);
} finally {
if (commitRateLimiter != null) {
commitRateLimiter.afterNonBlocking();
}
runningMonitor.leave();
}
}
}
PERF_LOGGER.end(start, 100, "Generated events (before: {}, after: {})", before, after);
} catch (Exception e) {
LOG.warn("Error while dispatching observation events for " + tracker, e);
}
}
Aggregations