Esempio n. 1
0
 internal virtual void DoFlush(IndexPopulation population)
 {
     try
     {
         population.Populator.add(population.TakeCurrentBatch());
     }
     catch (Exception failure)
     {
         Fail(population, failure);
     }
 }
        /// <summary>
        /// Insert the given batch of updates into the index defined by the given <seealso cref="IndexPopulation"/>.
        /// Called from <seealso cref="MultipleIndexPopulator.flush(IndexPopulation)"/>.
        /// </summary>
        /// <param name="population"> the index population. </param>
        internal override void DoFlush(IndexPopulation population)
        {
            _activeTasks.incrementAndGet();
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<org.neo4j.kernel.api.index.IndexEntryUpdate<?>> batch = population.takeCurrentBatch();
            IList <IndexEntryUpdate <object> > batch = population.TakeCurrentBatch();

            _executor.execute(() =>
            {
                try
                {
                    string batchDescription = "EMPTY";
                    if (PrintDebug)
                    {
                        if (batch.Count > 0)
                        {
                            batchDescription = format("[%d, %d - %d]", batch.Count, batch[0].EntityId, batch[batch.Count - 1].EntityId);
                        }
                        Log.info("Applying scan batch %s", batchDescription);
                    }
                    population.Populator.add(batch);
                    if (PrintDebug)
                    {
                        Log.info("Applied scan batch %s", batchDescription);
                    }
                }
                catch (Exception failure)
                {
                    Fail(population, failure);
                }
                finally
                {
                    _activeTasks.decrementAndGet();
                }
            });
        }