Beispiel #1
0
 public override Stat Stat(Key key)
 {
     if (key == Keys.done_batches)
     {
         return(longStat(Progress.sum() / BatchSize));
     }
     if (key == Keys.avg_processing_time)
     {
         return(longStat(10));
     }
     return(null);
 }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static long importData(String title, int numRunners, InputIterable data, org.neo4j.unsafe.impl.batchimport.store.BatchingNeoStores stores, System.Func<EntityImporter> visitors, org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitor executionMonitor, org.neo4j.unsafe.impl.batchimport.stats.StatsProvider memoryStatsProvider) throws java.io.IOException
        private static long ImportData(string title, int numRunners, InputIterable data, BatchingNeoStores stores, System.Func <EntityImporter> visitors, ExecutionMonitor executionMonitor, StatsProvider memoryStatsProvider)
        {
            LongAdder        roughEntityCountProgress = new LongAdder();
            ExecutorService  pool         = Executors.newFixedThreadPool(numRunners, new NamedThreadFactory(title + "Importer"));
            IoMonitor        writeMonitor = new IoMonitor(stores.IoTracer);
            ControllableStep step         = new ControllableStep(title, roughEntityCountProgress, Configuration.DEFAULT, writeMonitor, memoryStatsProvider);
            StageExecution   execution    = new StageExecution(title, null, Configuration.DEFAULT, Collections.singletonList(step), 0);
            long             startTime    = currentTimeMillis();

            using (InputIterator dataIterator = data.GetEnumerator())
            {
                executionMonitor.Start(execution);
                for (int i = 0; i < numRunners; i++)
                {
                    pool.submit(new ExhaustingEntityImporterRunnable(execution, dataIterator, visitors(), roughEntityCountProgress));
                }
                pool.shutdown();

                long nextWait = 0;
                try
                {
                    while (!pool.awaitTermination(nextWait, TimeUnit.MILLISECONDS))
                    {
                        executionMonitor.Check(execution);
                        nextWait = executionMonitor.NextCheckTime() - currentTimeMillis();
                    }
                }
                catch (InterruptedException e)
                {
                    Thread.CurrentThread.Interrupt();
                    throw new IOException(e);
                }
            }

            execution.AssertHealthy();
            step.MarkAsCompleted();
            writeMonitor.Stop();
            executionMonitor.End(execution, currentTimeMillis() - startTime);
            execution.AssertHealthy();

            return(roughEntityCountProgress.sum());
        }
Beispiel #3
0
 public override long UsedDirectMemory()
 {
     return(_allocatedBytes.sum());
 }
Beispiel #4
0
 public override Stat Stat(Key key)
 {
     return(key == Keys.io_throughput ? new IoThroughputStat(startTime, endTime, _recordSize * _recordsUpdated.sum()) : null);
 }
Beispiel #5
0
 public override long EvictionExceptions()
 {
     return(EvictionExceptionsConflict.sum());
 }
Beispiel #6
0
 public override long FilesUnmapped()
 {
     return(FilesUnmappedConflict.sum());
 }
Beispiel #7
0
 public override long BytesWritten()
 {
     return(BytesWrittenConflict.sum());
 }
Beispiel #8
0
 public override long BytesRead()
 {
     return(BytesReadConflict.sum());
 }
Beispiel #9
0
 public override long Flushes()
 {
     return(FlushesConflict.sum());
 }
Beispiel #10
0
 public override long Hits()
 {
     return(HitsConflict.sum());
 }
Beispiel #11
0
 public override long Unpins()
 {
     return(UnpinsConflict.sum());
 }
Beispiel #12
0
 public override long Pins()
 {
     return(PinsConflict.sum());
 }
Beispiel #13
0
 public override long Faults()
 {
     return(FaultsConflict.sum());
 }
Beispiel #14
0
 public override string ToString()
 {
     return(format("Imported:%n  %d nodes%n  %d relationships%n  %d properties", Nodes.sum(), Relationships.sum(), Properties.sum()));
 }