//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCancelPopulation() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestCancelPopulation() { IndexPopulator indexPopulator1 = CreateIndexPopulator(); IndexPopulator indexPopulator2 = CreateIndexPopulator(); AddPopulator(indexPopulator1, 1); AddPopulator(indexPopulator2, 2); _multipleIndexPopulator.cancel(); verify(_indexStoreView, times(2)).replaceIndexCounts(anyLong(), eq(0L), eq(0L), eq(0L)); verify(indexPopulator1).close(false); verify(indexPopulator2).close(false); }
/// <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)); } }