text: public override int DoLogic(){PerfRunData runData = RunData;IndexWriter w = runData.IndexWriter;if (w == null){throw new Exception("please open the writer before invoking NearRealtimeReader");}if (runData.GetIndexReader() != null){throw new Exception("please close the existing reader before invoking NearRealtimeReader");}long t = J2N.Time.CurrentTimeMilliseconds();DirectoryReader r = DirectoryReader.Open(w, true);runData.SetIndexReader(r);r.DecRef();reopenCount = 0;while (!Stop){long waitForMsec = (pauseMSec - (J2N.Time.CurrentTimeMilliseconds() - t));if (waitForMsec > 0){Thread.Sleep((int)waitForMsec);}t = J2N.Time.CurrentTimeMilliseconds();DirectoryReader newReader = DirectoryReader.OpenIfChanged(r);if (newReader != null){int delay = (int)(J2N.Time.CurrentTimeMilliseconds() - t);if (reopenTimes.Length == reopenCount){reopenTimes = ArrayUtil.Grow(reopenTimes, 1 + reopenCount);}reopenTimes[reopenCount++] = delay;runData.SetIndexReader(newReader);newReader.DecRef();r = newReader;}}Stop = false;return reopenCount;}