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