public override void Process <T1>(IndexEntryUpdate <T1> update) { Pair <IndexPopulation, IndexUpdater> pair = PopulationsWithUpdaters[update.IndexKey().schema()]; if (pair != null) { IndexPopulation population = pair.First(); IndexUpdater updater = pair.Other(); try { population.Populator.includeSample(update); updater.Process(update); } catch (Exception t) { try { updater.Close(); } catch (Exception ce) { Log.error(format("Failed to close index updater: [%s]", updater), ce); } PopulationsWithUpdaters.Remove(update.IndexKey().schema()); MultipleIndexPopulator.fail(population, t); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testFailPopulator() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestFailPopulator() { IndexPopulator indexPopulator1 = CreateIndexPopulator(); IndexPopulator indexPopulator2 = CreateIndexPopulator(); AddPopulator(indexPopulator1, 1); AddPopulator(indexPopulator2, 2); _multipleIndexPopulator.fail(PopulatorException); CheckPopulatorFailure(indexPopulator1); CheckPopulatorFailure(indexPopulator2); }
/// <summary> /// Scans the store using store view and populates all participating <seealso cref="IndexPopulator"/> with data relevant to /// each index. /// The scan continues as long as there's at least one non-failed populator. /// </summary> public override void Run() { string oldThreadName = currentThread().Name; try { if (!_multiPopulator.hasPopulators()) { return; } if (_storeScan != null) { throw new System.InvalidOperationException("Population already started."); } currentThread().Name = "Index populator"; try { _multiPopulator.create(); _multiPopulator.resetIndexCounts(); _monitor.indexPopulationScanStarting(); IndexAllEntities(); _monitor.indexPopulationScanComplete(); if (_cancelled) { _multiPopulator.cancel(); // We remain in POPULATING state return; } _multiPopulator.flipAfterPopulation(_verifyBeforeFlipping); } catch (Exception t) { _multiPopulator.fail(t); } } finally { // will only close "additional" resources, not the actual populators, since that's managed by flip Runnables.runAll("Failed to close resources in IndexPopulationJob", () => _multiPopulator.close(true), () => _monitor.populationJobCompleted(_memoryAllocationTracker.peakMemoryUsage()), _bufferFactory.close, _doneSignal.countDown, () => currentThread().setName(oldThreadName)); } }