Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canceledPopulationNotAbleToCreateNewIndex() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CanceledPopulationNotAbleToCreateNewIndex()
        {
            IndexPopulator  populator       = CreateIndexPopulator();
            IndexPopulation indexPopulation = AddPopulator(populator, 1);

            indexPopulation.Cancel();

            _multipleIndexPopulator.create();

            verify(populator, never()).create();
        }
Exemplo n.º 2
0
        /// <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));
            }
        }