Lucene.Net.ThreadSafetyTest.Main C# (CSharp) Method

Main() private method

private Main ( System args ) : void
args System
return void
		public static void  Main(System.String[] args)
		{
			
			bool readOnly = false;
			bool add = false;
			
			for (int i = 0; i < args.Length; i++)
			{
				if ("-ro".Equals(args[i]))
					readOnly = true;
				if ("-add".Equals(args[i]))
					add = true;
			}
			
			System.IO.FileInfo indexDir = new System.IO.FileInfo("index");
			bool tmpBool;
			if (System.IO.File.Exists(indexDir.FullName))
				tmpBool = true;
			else
				tmpBool = System.IO.Directory.Exists(indexDir.FullName);
			if (!tmpBool)
			{
				System.IO.Directory.CreateDirectory(indexDir.FullName);
			}
			
			IndexReader.Unlock(FSDirectory.GetDirectory(indexDir, false));
			
			if (!readOnly)
			{
				IndexWriter writer = new IndexWriter(indexDir, ANALYZER, !add);
				
				SupportClass.ThreadClass indexerThread = new IndexerThread(writer);
				indexerThread.Start();
				
				System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 1000));
			}
			
			SearcherThread searcherThread1 = new SearcherThread(false);
			searcherThread1.Start();
			
			SEARCHER = new IndexSearcher(indexDir.ToString());
			
			SearcherThread searcherThread2 = new SearcherThread(true);
			searcherThread2.Start();
			
			SearcherThread searcherThread3 = new SearcherThread(true);
			searcherThread3.Start();
		}
	}
ThreadSafetyTest