public override IndexInput OpenInput(string name, IOContext context) { lock (this) { MaybeThrowDeterministicException(); MaybeThrowIOExceptionOnOpen(name); MaybeYield(); if (FailOnOpenInput_Renamed) { MaybeThrowDeterministicException(); } if (!LuceneTestCase.SlowFileExists(@in, name)) { throw new FileNotFoundException(name + " in dir=" + @in); } // cannot open a file for input if it's still open for // output, except for segments.gen and segments_N if (!AllowReadingFilesStillOpenForWrite_Renamed && OpenFilesForWrite.Contains(name) && !name.StartsWith("segments")) { throw FillOpenTrace(new System.IO.IOException("MockDirectoryWrapper: file \"" + name + "\" is still open for writing"), name, false); } IndexInput delegateInput = @in.OpenInput(name, LuceneTestCase.NewIOContext(RandomState, context)); IndexInput ii; int randomInt = RandomState.Next(500); if (randomInt == 0) { if (LuceneTestCase.VERBOSE) { Console.WriteLine("MockDirectoryWrapper: using SlowClosingMockIndexInputWrapper for file " + name); } ii = new SlowClosingMockIndexInputWrapper(this, name, delegateInput); } else if (randomInt == 1) { if (LuceneTestCase.VERBOSE) { Console.WriteLine("MockDirectoryWrapper: using SlowOpeningMockIndexInputWrapper for file " + name); } ii = new SlowOpeningMockIndexInputWrapper(this, name, delegateInput); } else { ii = new MockIndexInputWrapper(this, name, delegateInput); } AddFileHandle(ii, name, Handle.Input); return ii; } }