use of org.neo4j.kernel.impl.api.index.updater.DelegatingIndexUpdater in project neo4j by neo4j.
the class BlockBasedIndexPopulator method newPopulatingUpdater.
@Override
public IndexUpdater newPopulatingUpdater(CursorContext cursorContext) {
if (scanCompleted) {
// Will need the reader from newReader, which a sub-class of this class implements
return new DelegatingIndexUpdater(super.newPopulatingUpdater(cursorContext)) {
@Override
public void process(IndexEntryUpdate<?> update) throws IndexEntryConflictException {
ValueIndexEntryUpdate<?> valueUpdate = asValueUpdate(update);
validateUpdate(valueUpdate);
numberOfIndexUpdatesSinceSample.incrementAndGet();
super.process(valueUpdate);
}
};
}
return new IndexUpdater() {
private volatile boolean closed;
@Override
public void process(IndexEntryUpdate<?> update) {
assertOpen();
ValueIndexEntryUpdate<?> valueUpdate = asValueUpdate(update);
try {
validateUpdate(valueUpdate);
externalUpdates.add(valueUpdate);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
@Override
public void close() {
closed = true;
}
private void assertOpen() {
if (closed) {
throw new IllegalStateException("Updater has been closed");
}
}
};
}
Aggregations