use of org.apache.jackrabbit.oak.plugins.observation.FilteringAwareObserver in project jackrabbit-oak by apache.
the class PrefilteringBackgroundObserverTest method init.
public void init(int queueLength) throws Exception {
runnableQ = new LinkedList<Runnable>();
executor = new EnqueuingExecutorService(runnableQ);
compositeObserver = new CompositeObserver();
received = new LinkedList<ContentChanged>();
filteringObserver = new FilteringObserver(executor, queueLength, new Filter() {
@Override
public boolean excludes(NodeState root, CommitInfo info) {
if (info == includingCommitInfo) {
return false;
} else if (info == excludingCommitInfo) {
return true;
} else if (info.isExternal()) {
return false;
}
throw new IllegalStateException("only supporting include or exclude");
}
}, new FilteringAwareObserver() {
NodeState previous;
@Override
public void contentChanged(NodeState before, NodeState after, CommitInfo info) {
received.add(new ContentChanged(after, info));
if (previous != null && previous != before) {
resetCallCnt++;
}
previous = after;
}
});
compositeObserver.addObserver(filteringObserver);
}
Aggregations