Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writeOneIteration(TestCoordinator testCoordinator, java.util.concurrent.atomic.AtomicBoolean failHalt) throws java.io.IOException, InterruptedException
        private void WriteOneIteration(TestCoordinator testCoordinator, AtomicBoolean failHalt)
        {
            int batchSize = testCoordinator.WriteBatchSize();
            IEnumerable <UpdateOperation> toWrite         = testCoordinator.NextToWrite();
            IEnumerator <UpdateOperation> toWriteIterator = toWrite.GetEnumerator();

            while (toWriteIterator.MoveNext())
            {
                using (Writer <KEY, VALUE> writer = _index.writer())
                {
                    int inBatch = 0;
                    while (toWriteIterator.MoveNext() && inBatch < batchSize)
                    {
                        UpdateOperation operation = toWriteIterator.Current;
                        operation.Apply(writer);
                        if (failHalt.get())
                        {
                            break;
                        }
                        inBatch++;
                    }
                }
                // Sleep to allow checkpointer to step in
                MILLISECONDS.sleep(1);
            }
        }