lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [5/6] lucenenet git commit: Lucene.Net.TestFramework.Index.ThreadedIndexingAndSearchingTestCase + Lucene.Net.Tests.Index.TestNRTThreads + Lucene.Net.Tests.Search (TestControlledRealTimeReopenThread + TestSearcherManager): Fixed some minor bugs and format
Date Wed, 22 Mar 2017 04:25:41 GMT
Lucene.Net.TestFramework.Index.ThreadedIndexingAndSearchingTestCase + Lucene.Net.Tests.Index.TestNRTThreads + Lucene.Net.Tests.Search (TestControlledRealTimeReopenThread + TestSearcherManager): Fixed some minor bugs and formatting issues.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/7eeaca9b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/7eeaca9b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/7eeaca9b

Branch: refs/heads/api-work
Commit: 7eeaca9b4bdaef2622a751f2d6ba16206da61b8d
Parents: acc553e
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Mar 22 09:40:27 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Mar 22 09:40:27 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/SegmentReader.cs      |  13 +-
 .../ThreadedIndexingAndSearchingTestCase.cs     | 273 ++++++++++---------
 src/Lucene.Net.Tests/Index/TestNRTThreads.cs    |  26 +-
 .../TestControlledRealTimeReopenThread.cs       | 257 ++++++++---------
 .../Search/TestSearcherManager.cs               | 212 +++++++-------
 5 files changed, 393 insertions(+), 388 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7eeaca9b/src/Lucene.Net.Core/Index/SegmentReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentReader.cs b/src/Lucene.Net.Core/Index/SegmentReader.cs
index e6bce27..50dba2d 100644
--- a/src/Lucene.Net.Core/Index/SegmentReader.cs
+++ b/src/Lucene.Net.Core/Index/SegmentReader.cs
@@ -51,11 +51,10 @@ namespace Lucene.Net.Index
         // tells us the docCount:
         private readonly int numDocs;
 
-        private readonly SegmentCoreReaders core; // LUCENENET specific - made private
-        private readonly SegmentDocValues segDocValues; // LUCENENET specific - made private
+        internal readonly SegmentCoreReaders core;
+        internal readonly SegmentDocValues segDocValues;
 
-        // LUCENENET specific - made private
-        private readonly DisposableThreadLocal<IDictionary<string, object>> docValuesLocal = new DisposableThreadLocalAnonymousInnerClassHelper();
+        internal readonly DisposableThreadLocal<IDictionary<string, object>> docValuesLocal = new DisposableThreadLocalAnonymousInnerClassHelper();
 
         private class DisposableThreadLocalAnonymousInnerClassHelper : DisposableThreadLocal<IDictionary<string, object>>
         {
@@ -83,10 +82,8 @@ namespace Lucene.Net.Index
             }
         }
 
-        // LUCENENET specific - made private
-        private readonly IDictionary<string, DocValuesProducer> dvProducersByField = new Dictionary<string, DocValuesProducer>();
-        // LUCENENET specific - made private
-        private readonly ISet<DocValuesProducer> dvProducers = new IdentityHashSet<DocValuesProducer>();
+        internal readonly IDictionary<string, DocValuesProducer> dvProducersByField = new Dictionary<string, DocValuesProducer>();
+        internal readonly ISet<DocValuesProducer> dvProducers = new IdentityHashSet<DocValuesProducer>();
 
         private readonly FieldInfos fieldInfos; // LUCENENET specific - since it is readonly, made all internal classes use property
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7eeaca9b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
index 025b601..631346c 100644
--- a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
@@ -64,24 +64,24 @@ namespace Lucene.Net.Index
     /// </summary>
     public abstract class ThreadedIndexingAndSearchingTestCase : LuceneTestCase
     {
-        protected internal readonly AtomicBoolean Failed = new AtomicBoolean();
-        protected internal readonly AtomicInt32 AddCount = new AtomicInt32();
-        protected internal readonly AtomicInt32 DelCount = new AtomicInt32();
-        protected internal readonly AtomicInt32 PackCount = new AtomicInt32();
+        protected internal readonly AtomicBoolean failed = new AtomicBoolean();
+        protected internal readonly AtomicInt32 addCount = new AtomicInt32();
+        protected internal readonly AtomicInt32 delCount = new AtomicInt32();
+        protected internal readonly AtomicInt32 packCount = new AtomicInt32();
 
-        protected internal Directory Dir;
-        protected internal IndexWriter Writer;
+        protected internal Directory dir;
+        protected internal IndexWriter writer;
 
         private class SubDocs
         {
-            public readonly string PackID;
-            public readonly IList<string> SubIDs;
-            public bool Deleted;
+            public readonly string packID;
+            public readonly IList<string> subIDs;
+            public bool deleted;
 
             public SubDocs(string packID, IList<string> subIDs)
             {
-                this.PackID = packID;
-                this.SubIDs = subIDs;
+                this.packID = packID;
+                this.subIDs = subIDs;
             }
         }
 
@@ -95,7 +95,7 @@ namespace Lucene.Net.Index
         }
 
         // Called once to run searching
-        protected internal abstract void DoSearching(TaskScheduler es, DateTime stopTime);
+        protected internal abstract void DoSearching(TaskScheduler es, long stopTime);
 
         protected internal virtual Directory GetDirectory(Directory @in)
         {
@@ -104,34 +104,39 @@ namespace Lucene.Net.Index
 
         protected internal virtual void UpdateDocuments(Term id, IEnumerable<IEnumerable<IIndexableField>> docs)
         {
-            Writer.UpdateDocuments(id, docs);
+            writer.UpdateDocuments(id, docs);
         }
 
         protected internal virtual void AddDocuments(Term id, IEnumerable<IEnumerable<IIndexableField>> docs)
         {
-            Writer.AddDocuments(docs);
+            writer.AddDocuments(docs);
         }
 
         protected internal virtual void AddDocument(Term id, IEnumerable<IIndexableField> doc)
         {
-            Writer.AddDocument(doc);
+            writer.AddDocument(doc);
         }
 
         protected internal virtual void UpdateDocument(Term term, IEnumerable<IIndexableField> doc)
         {
-            Writer.UpdateDocument(term, doc);
+            writer.UpdateDocument(term, doc);
         }
 
         protected internal virtual void DeleteDocuments(Term term)
         {
-            Writer.DeleteDocuments(term);
+            writer.DeleteDocuments(term);
         }
 
         protected internal virtual void DoAfterIndexingThreadDone()
         {
         }
 
-        private ThreadClass[] LaunchIndexingThreads(LineFileDocs docs, int numThreads, DateTime stopTime, ISet<string> delIDs, ISet<string> delPackIDs, IList<SubDocs> allSubDocs)
+        private ThreadClass[] LaunchIndexingThreads(LineFileDocs docs, 
+                                                    int numThreads, 
+                                                    long stopTime, 
+                                                    ISet<string> delIDs, 
+                                                    ISet<string> delPackIDs, 
+                                                    IList<SubDocs> allSubDocs)
         {
             ThreadClass[] threads = new ThreadClass[numThreads];
             for (int thread = 0; thread < numThreads; thread++)
@@ -146,22 +151,22 @@ namespace Lucene.Net.Index
 
         private class ThreadAnonymousInnerClassHelper : ThreadClass
         {
-            private readonly ThreadedIndexingAndSearchingTestCase OuterInstance;
+            private readonly ThreadedIndexingAndSearchingTestCase outerInstance;
 
-            private LineFileDocs Docs;
-            private DateTime StopTime;
-            private ISet<string> DelIDs;
-            private ISet<string> DelPackIDs;
-            private IList<SubDocs> AllSubDocs;
+            private LineFileDocs docs;
+            private long stopTime;
+            private ISet<string> delIDs;
+            private ISet<string> delPackIDs;
+            private IList<SubDocs> allSubDocs;
 
-            public ThreadAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance, LineFileDocs docs, DateTime stopTime, ISet<string> delIDs, ISet<string> delPackIDs, IList<SubDocs> allSubDocs)
+            public ThreadAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance, LineFileDocs docs, long stopTime, ISet<string> delIDs, ISet<string> delPackIDs, IList<SubDocs> allSubDocs)
             {
-                this.OuterInstance = outerInstance;
-                this.Docs = docs;
-                this.StopTime = stopTime;
-                this.DelIDs = delIDs;
-                this.DelPackIDs = delPackIDs;
-                this.AllSubDocs = allSubDocs;
+                this.outerInstance = outerInstance;
+                this.docs = docs;
+                this.stopTime = stopTime;
+                this.delIDs = delIDs;
+                this.delPackIDs = delPackIDs;
+                this.allSubDocs = allSubDocs;
             }
 
             public override void Run()
@@ -169,7 +174,7 @@ namespace Lucene.Net.Index
                 // TODO: would be better if this were cross thread, so that we make sure one thread deleting anothers added docs works:
                 IList<string> toDeleteIDs = new List<string>();
                 IList<SubDocs> toDeleteSubDocs = new List<SubDocs>();
-                while (DateTime.UtcNow < StopTime && !OuterInstance.Failed.Get())
+                while (Environment.TickCount < stopTime && !outerInstance.failed.Get())
                 {
                     try
                     {
@@ -194,7 +199,7 @@ namespace Lucene.Net.Index
                             }
                         }
 
-                        Document doc = Docs.NextDoc();
+                        Document doc = docs.NextDoc();
                         if (doc == null)
                         {
                             break;
@@ -205,7 +210,7 @@ namespace Lucene.Net.Index
                         if (Random().NextBoolean())
                         {
                             addedField = "extra" + Random().Next(40);
-                            doc.Add(OuterInstance.NewTextField(addedField, "a random field", Field.Store.YES));
+                            doc.Add(outerInstance.NewTextField(addedField, "a random field", Field.Store.YES));
                         }
                         else
                         {
@@ -222,24 +227,24 @@ namespace Lucene.Net.Index
                                 if (toDeleteSubDocs.Count > 0 && Random().NextBoolean())
                                 {
                                     delSubDocs = toDeleteSubDocs[Random().Next(toDeleteSubDocs.Count)];
-                                    Debug.Assert(!delSubDocs.Deleted);
+                                    Debug.Assert(!delSubDocs.deleted);
                                     toDeleteSubDocs.Remove(delSubDocs);
                                     // Update doc block, replacing prior packID
-                                    packID = delSubDocs.PackID;
+                                    packID = delSubDocs.packID;
                                 }
                                 else
                                 {
                                     delSubDocs = null;
                                     // Add doc block, using new packID
-                                    packID = OuterInstance.PackCount.IncrementAndGet() + "";
+                                    packID = outerInstance.packCount.GetAndIncrement().ToString(CultureInfo.InvariantCulture);
                                 }
 
-                                Field packIDField = OuterInstance.NewStringField("packID", packID, Field.Store.YES);
+                                Field packIDField = outerInstance.NewStringField("packID", packID, Field.Store.YES);
                                 IList<string> docIDs = new List<string>();
                                 SubDocs subDocs = new SubDocs(packID, docIDs);
                                 IList<Document> docsList = new List<Document>();
 
-                                AllSubDocs.Add(subDocs);
+                                allSubDocs.Add(subDocs);
                                 doc.Add(packIDField);
                                 docsList.Add(TestUtil.CloneDocument(doc));
                                 docIDs.Add(doc.Get("docid"));
@@ -247,7 +252,7 @@ namespace Lucene.Net.Index
                                 int maxDocCount = TestUtil.NextInt(Random(), 1, 10);
                                 while (docsList.Count < maxDocCount)
                                 {
-                                    doc = Docs.NextDoc();
+                                    doc = docs.NextDoc();
                                     if (doc == null)
                                     {
                                         break;
@@ -255,20 +260,20 @@ namespace Lucene.Net.Index
                                     docsList.Add(TestUtil.CloneDocument(doc));
                                     docIDs.Add(doc.Get("docid"));
                                 }
-                                OuterInstance.AddCount.AddAndGet(docsList.Count);
+                                outerInstance.addCount.AddAndGet(docsList.Count);
 
                                 Term packIDTerm = new Term("packID", packID);
 
                                 if (delSubDocs != null)
                                 {
-                                    delSubDocs.Deleted = true;
-                                    DelIDs.AddAll(delSubDocs.SubIDs);
-                                    OuterInstance.DelCount.AddAndGet(delSubDocs.SubIDs.Count);
+                                    delSubDocs.deleted = true;
+                                    delIDs.AddAll(delSubDocs.subIDs);
+                                    outerInstance.delCount.AddAndGet(delSubDocs.subIDs.Count);
                                     if (VERBOSE)
                                     {
-                                        Console.WriteLine(Thread.CurrentThread.Name + ": update pack packID=" + delSubDocs.PackID + " count=" + docsList.Count + " docs=" + Arrays.ToString(docIDs));
+                                        Console.WriteLine(Thread.CurrentThread.Name + ": update pack packID=" + delSubDocs.packID + " count=" + docsList.Count + " docs=" + Arrays.ToString(docIDs));
                                     }
-                                    OuterInstance.UpdateDocuments(packIDTerm, docsList);
+                                    outerInstance.UpdateDocuments(packIDTerm, docsList);
                                 }
                                 else
                                 {
@@ -276,7 +281,7 @@ namespace Lucene.Net.Index
                                     {
                                         Console.WriteLine(Thread.CurrentThread.Name + ": add pack packID=" + packID + " count=" + docsList.Count + " docs=" + Arrays.ToString(docIDs));
                                     }
-                                    OuterInstance.AddDocuments(packIDTerm, docsList);
+                                    outerInstance.AddDocuments(packIDTerm, docsList);
                                 }
                                 doc.RemoveField("packID");
 
@@ -297,8 +302,8 @@ namespace Lucene.Net.Index
                                 {
                                     Console.WriteLine(Thread.CurrentThread.Name + ": add doc docid:" + docid);
                                 }
-                                OuterInstance.AddDocument(new Term("docid", docid), doc);
-                                OuterInstance.AddCount.IncrementAndGet();
+                                outerInstance.AddDocument(new Term("docid", docid), doc);
+                                outerInstance.addCount.GetAndIncrement();
 
                                 if (Random().Next(5) == 3)
                                 {
@@ -320,8 +325,8 @@ namespace Lucene.Net.Index
                                 Console.WriteLine(Thread.CurrentThread.Name + ": update doc id:" + doc.Get("docid"));
                             }
                             string docid = doc.Get("docid");
-                            OuterInstance.UpdateDocument(new Term("docid", docid), doc);
-                            OuterInstance.AddCount.IncrementAndGet();
+                            outerInstance.UpdateDocument(new Term("docid", docid), doc);
+                            outerInstance.addCount.GetAndIncrement();
 
                             if (Random().Next(5) == 3)
                             {
@@ -345,28 +350,28 @@ namespace Lucene.Net.Index
                                 {
                                     Console.WriteLine(Thread.CurrentThread.Name + ": del term=id:" + id);
                                 }
-                                OuterInstance.DeleteDocuments(new Term("docid", id));
+                                outerInstance.DeleteDocuments(new Term("docid", id));
                             }
-                            int count = OuterInstance.DelCount.AddAndGet(toDeleteIDs.Count);
+                            int count = outerInstance.delCount.AddAndGet(toDeleteIDs.Count);
                             if (VERBOSE)
                             {
                                 Console.WriteLine(Thread.CurrentThread.Name + ": tot " + count + " deletes");
                             }
-                            DelIDs.AddAll(toDeleteIDs);
+                            delIDs.AddAll(toDeleteIDs);
                             toDeleteIDs.Clear();
 
                             foreach (SubDocs subDocs in toDeleteSubDocs)
                             {
-                                Debug.Assert(!subDocs.Deleted);
-                                DelPackIDs.Add(subDocs.PackID);
-                                OuterInstance.DeleteDocuments(new Term("packID", subDocs.PackID));
-                                subDocs.Deleted = true;
+                                Debug.Assert(!subDocs.deleted);
+                                delPackIDs.Add(subDocs.packID);
+                                outerInstance.DeleteDocuments(new Term("packID", subDocs.packID));
+                                subDocs.deleted = true;
                                 if (VERBOSE)
                                 {
-                                    Console.WriteLine(Thread.CurrentThread.Name + ": del subs: " + subDocs.SubIDs + " packID=" + subDocs.PackID);
+                                    Console.WriteLine(Thread.CurrentThread.Name + ": del subs: " + subDocs.subIDs + " packID=" + subDocs.packID);
                                 }
-                                DelIDs.AddAll(subDocs.SubIDs);
-                                OuterInstance.DelCount.AddAndGet(subDocs.SubIDs.Count);
+                                delIDs.AddAll(subDocs.subIDs);
+                                outerInstance.delCount.AddAndGet(subDocs.subIDs.Count);
                             }
                             toDeleteSubDocs.Clear();
                         }
@@ -380,8 +385,8 @@ namespace Lucene.Net.Index
                         Console.WriteLine(Thread.CurrentThread.Name + ": hit exc");
                         Console.WriteLine(t.ToString());
                         Console.Write(t.StackTrace);
-                        OuterInstance.Failed.Set(true);
-                        throw new Exception(t.Message, t);
+                        outerInstance.failed.Set(true);
+                        throw new Exception(t.ToString(), t);
                     }
                 }
                 if (VERBOSE)
@@ -389,11 +394,11 @@ namespace Lucene.Net.Index
                     Console.WriteLine(Thread.CurrentThread.Name + ": indexing done");
                 }
 
-                OuterInstance.DoAfterIndexingThreadDone();
+                outerInstance.DoAfterIndexingThreadDone();
             }
         }
 
-        protected internal virtual void RunSearchThreads(DateTime stopTime)
+        protected internal virtual void RunSearchThreads(long stopTime)
         {
             int numThreads = TestUtil.NextInt(Random(), 1, 5);
             ThreadClass[] searchThreads = new ThreadClass[numThreads];
@@ -423,18 +428,18 @@ namespace Lucene.Net.Index
 
         private class ThreadAnonymousInnerClassHelper2 : ThreadClass
         {
-            private readonly ThreadedIndexingAndSearchingTestCase OuterInstance;
+            private readonly ThreadedIndexingAndSearchingTestCase outerInstance;
 
-            private DateTime StopTime;
-            private AtomicInt32 TotHits;
-            private AtomicInt32 TotTermCount;
+            private long stopTimeMS;
+            private AtomicInt32 totHits;
+            private AtomicInt32 totTermCount;
 
-            public ThreadAnonymousInnerClassHelper2(ThreadedIndexingAndSearchingTestCase outerInstance, DateTime stopTime, AtomicInt32 totHits, AtomicInt32 totTermCount)
+            public ThreadAnonymousInnerClassHelper2(ThreadedIndexingAndSearchingTestCase outerInstance, long stopTimeMS, AtomicInt32 totHits, AtomicInt32 totTermCount)
             {
-                this.OuterInstance = outerInstance;
-                this.StopTime = stopTime;
-                this.TotHits = totHits;
-                this.TotTermCount = totTermCount;
+                this.outerInstance = outerInstance;
+                this.stopTimeMS = stopTimeMS;
+                this.totHits = totHits;
+                this.totTermCount = totTermCount;
             }
 
             public override void Run()
@@ -443,11 +448,11 @@ namespace Lucene.Net.Index
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": launch search thread");
                 }
-                while (DateTime.UtcNow < StopTime)
+                while (Environment.TickCount < stopTimeMS)
                 {
                     try
                     {
-                        IndexSearcher s = OuterInstance.CurrentSearcher;
+                        IndexSearcher s = outerInstance.CurrentSearcher;
                         try
                         {
                             // Verify 1) IW is correctly setting
@@ -457,17 +462,19 @@ namespace Lucene.Net.Index
                             {
                                 SegmentReader segReader = (SegmentReader)sub.Reader;
                                 IDictionary<string, string> diagnostics = segReader.SegmentInfo.Info.Diagnostics;
-                                Assert.IsNotNull(diagnostics);
-                                string source = diagnostics["source"];
-                                Assert.IsNotNull(source);
+                                assertNotNull(diagnostics);
+                                string source;
+                                diagnostics.TryGetValue("source", out source);
+                                assertNotNull(source);
                                 if (source.Equals("merge", StringComparison.Ordinal))
                                 {
-                                    Assert.IsTrue(!OuterInstance.AssertMergedSegmentsWarmed || OuterInstance.Warmed.ContainsKey((SegmentCoreReaders)segReader.CoreCacheKey), "sub reader " + sub + " wasn't warmed: warmed=" + OuterInstance.Warmed + " diagnostics=" + diagnostics + " si=" + segReader.SegmentInfo);
+                                    assertTrue("sub reader " + sub + " wasn't warmed: warmed=" + outerInstance.warmed + " diagnostics=" + diagnostics + " si=" + segReader.SegmentInfo,
+                                        !outerInstance.assertMergedSegmentsWarmed || outerInstance.warmed.ContainsKey(segReader.core));
                                 }
                             }
                             if (s.IndexReader.NumDocs > 0)
                             {
-                                OuterInstance.SmokeTestSearcher(s);
+                                outerInstance.SmokeTestSearcher(s);
                                 Fields fields = MultiFields.GetFields(s.IndexReader);
                                 if (fields == null)
                                 {
@@ -482,22 +489,22 @@ namespace Lucene.Net.Index
                                 int seenTermCount = 0;
                                 int shift;
                                 int trigger;
-                                if (TotTermCount.Get() < 30)
+                                if (totTermCount.Get() < 30)
                                 {
                                     shift = 0;
                                     trigger = 1;
                                 }
                                 else
                                 {
-                                    trigger = TotTermCount.Get() / 30;
+                                    trigger = totTermCount.Get() / 30;
                                     shift = Random().Next(trigger);
                                 }
-                                while (DateTime.UtcNow < StopTime)
+                                while (Environment.TickCount < stopTimeMS)
                                 {
                                     BytesRef term = termsEnum.Next();
                                     if (term == null)
                                     {
-                                        TotTermCount.Set(seenTermCount);
+                                        totTermCount.Set(seenTermCount);
                                         break;
                                     }
                                     seenTermCount++;
@@ -507,7 +514,7 @@ namespace Lucene.Net.Index
                                         //if (VERBOSE) {
                                         //System.out.println(Thread.currentThread().getName() + " now search body:" + term.Utf8ToString());
                                         //}
-                                        TotHits.AddAndGet(OuterInstance.RunQuery(s, new TermQuery(new Term("body", term))));
+                                        totHits.AddAndGet(outerInstance.RunQuery(s, new TermQuery(new Term("body", term))));
                                     }
                                 }
                                 //if (VERBOSE) {
@@ -517,15 +524,15 @@ namespace Lucene.Net.Index
                         }
                         finally
                         {
-                            OuterInstance.ReleaseSearcher(s);
+                            outerInstance.ReleaseSearcher(s);
                         }
                     }
                     catch (Exception t)
                     {
                         Console.WriteLine(Thread.CurrentThread.Name + ": hit exc");
-                        OuterInstance.Failed.Set(true);
-                        Console.WriteLine(t.StackTrace);
-                        throw new Exception(t.Message, t);
+                        outerInstance.failed.Set(true);
+                        Console.WriteLine(t.ToString());
+                        throw new Exception(t.ToString(), t);
                     }
                 }
             }
@@ -539,27 +546,27 @@ namespace Lucene.Net.Index
         {
         }
 
-        protected internal bool AssertMergedSegmentsWarmed = true;
+        protected internal bool assertMergedSegmentsWarmed = true;
 
-        private readonly IDictionary<SegmentCoreReaders, bool?> Warmed = new ConcurrentHashMapWrapper<SegmentCoreReaders, bool?>(new HashMap<SegmentCoreReaders, bool?>());
+        private readonly IDictionary<SegmentCoreReaders, bool?> warmed = new WeakDictionary<SegmentCoreReaders, bool?>(); //new ConcurrentHashMapWrapper<SegmentCoreReaders, bool?>(new HashMap<SegmentCoreReaders, bool?>());
         // Collections.synchronizedMap(new WeakHashMap<SegmentCoreReaders, bool?>());
 
         public virtual void RunTest(string testName)
         {
-            Failed.Set(false);
-            AddCount.Set(0);
-            DelCount.Set(0);
-            PackCount.Set(0);
+            failed.Set(false);
+            addCount.Set(0);
+            delCount.Set(0);
+            packCount.Set(0);
 
-            DateTime t0 = DateTime.UtcNow;
+            long t0 = Environment.TickCount;
 
             Random random = new Random(Random().Next());
             LineFileDocs docs = new LineFileDocs(random, DefaultCodecSupportsDocValues());
             DirectoryInfo tempDir = CreateTempDir(testName);
-            Dir = GetDirectory(NewMockFSDirectory(tempDir)); // some subclasses rely on this being MDW
-            if (Dir is BaseDirectoryWrapper)
+            dir = GetDirectory(NewMockFSDirectory(tempDir)); // some subclasses rely on this being MDW
+            if (dir is BaseDirectoryWrapper)
             {
-                ((BaseDirectoryWrapper)Dir).CheckIndexOnClose = false; // don't double-checkIndex, we do it ourselves.
+                ((BaseDirectoryWrapper)dir).CheckIndexOnClose = false; // don't double-checkIndex, we do it ourselves.
             }
             MockAnalyzer analyzer = new MockAnalyzer(Random());
             analyzer.MaxTokenLength = TestUtil.NextInt(Random(), 1, IndexWriter.MAX_TERM_LENGTH);
@@ -591,8 +598,8 @@ namespace Lucene.Net.Index
             {
                 conf.SetInfoStream(new PrintStreamInfoStreamAnonymousInnerClassHelper(this, Console.Out));
             }
-            Writer = new IndexWriter(Dir, conf);
-            TestUtil.ReduceOpenFiles(Writer);
+            writer = new IndexWriter(dir, conf);
+            TestUtil.ReduceOpenFiles(writer);
 
             TaskScheduler es = Random().NextBoolean() ? null : TaskScheduler.Default;
 
@@ -606,13 +613,13 @@ namespace Lucene.Net.Index
             ISet<string> delPackIDs = new ConcurrentHashSet<string>(new HashSet<string>());
             ConcurrentQueue<SubDocs> allSubDocs = new ConcurrentQueue<SubDocs>();
 
-            DateTime stopTime = DateTime.UtcNow.AddSeconds(RUN_TIME_SEC);
+            long stopTime = Environment.TickCount + (RUN_TIME_SEC * 1000);
 
             ThreadClass[] indexThreads = LaunchIndexingThreads(docs, NUM_INDEX_THREADS, stopTime, delIDs, delPackIDs, allSubDocs.ToList());
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: DONE start " + NUM_INDEX_THREADS + " indexing threads [" + (DateTime.UtcNow - t0).TotalMilliseconds + " ms]");
+                Console.WriteLine("TEST: DONE start " + NUM_INDEX_THREADS + " indexing threads [" + (Environment.TickCount - t0) + " ms]");
             }
 
             // Let index build up a bit
@@ -622,7 +629,7 @@ namespace Lucene.Net.Index
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: all searching done [" + (DateTime.UtcNow - t0).TotalMilliseconds + " ms]");
+                Console.WriteLine("TEST: all searching done [" + (Environment.TickCount - t0) + " ms]");
             }
 
             for (int thread = 0; thread < indexThreads.Length; thread++)
@@ -632,7 +639,7 @@ namespace Lucene.Net.Index
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: done join indexing threads [" + (DateTime.UtcNow - t0).TotalMilliseconds + " ms]; addCount=" + AddCount + " delCount=" + DelCount);
+                Console.WriteLine("TEST: done join indexing threads [" + (Environment.TickCount - t0) + " ms]; addCount=" + addCount + " delCount=" + delCount);
             }
 
             IndexSearcher s = FinalSearcher;
@@ -641,7 +648,7 @@ namespace Lucene.Net.Index
                 Console.WriteLine("TEST: finalSearcher=" + s);
             }
 
-            Assert.IsFalse(Failed.Get());
+            assertFalse(failed.Get());
 
             bool doFail = false;
 
@@ -670,13 +677,13 @@ namespace Lucene.Net.Index
             // Verify: make sure each group of sub-docs are still in docID order:
             foreach (SubDocs subDocs in allSubDocs.ToList())
             {
-                TopDocs hits = s.Search(new TermQuery(new Term("packID", subDocs.PackID)), 20);
-                if (!subDocs.Deleted)
+                TopDocs hits = s.Search(new TermQuery(new Term("packID", subDocs.packID)), 20);
+                if (!subDocs.deleted)
                 {
                     // We sort by relevance but the scores should be identical so sort falls back to by docID:
-                    if (hits.TotalHits != subDocs.SubIDs.Count)
+                    if (hits.TotalHits != subDocs.subIDs.Count)
                     {
-                        Console.WriteLine("packID=" + subDocs.PackID + ": expected " + subDocs.SubIDs.Count + " hits but got " + hits.TotalHits);
+                        Console.WriteLine("packID=" + subDocs.packID + ": expected " + subDocs.subIDs.Count + " hits but got " + hits.TotalHits);
                         doFail = true;
                     }
                     else
@@ -688,7 +695,7 @@ namespace Lucene.Net.Index
                             int docID = scoreDoc.Doc;
                             if (lastDocID != -1)
                             {
-                                Assert.AreEqual(1 + lastDocID, docID);
+                                assertEquals(1 + lastDocID, docID);
                             }
                             else
                             {
@@ -696,18 +703,18 @@ namespace Lucene.Net.Index
                             }
                             lastDocID = docID;
                             Document doc = s.Doc(docID);
-                            Assert.AreEqual(subDocs.PackID, doc.Get("packID"));
+                            assertEquals(subDocs.packID, doc.Get("packID"));
                         }
 
                         lastDocID = startDocID - 1;
-                        foreach (string subID in subDocs.SubIDs)
+                        foreach (string subID in subDocs.subIDs)
                         {
                             hits = s.Search(new TermQuery(new Term("docid", subID)), 1);
-                            Assert.AreEqual(1, hits.TotalHits);
+                            assertEquals(1, hits.TotalHits);
                             int docID = hits.ScoreDocs[0].Doc;
                             if (lastDocID != -1)
                             {
-                                Assert.AreEqual(1 + lastDocID, docID);
+                                assertEquals(1 + lastDocID, docID);
                             }
                             lastDocID = docID;
                         }
@@ -718,9 +725,9 @@ namespace Lucene.Net.Index
                     // Pack was deleted -- make sure its docs are
                     // deleted.  We can't verify packID is deleted
                     // because we can re-use packID for update:
-                    foreach (string subID in subDocs.SubIDs)
+                    foreach (string subID in subDocs.subIDs)
                     {
-                        Assert.AreEqual(0, s.Search(new TermQuery(new Term("docid", subID)), 1).TotalHits);
+                        assertEquals(0, s.Search(new TermQuery(new Term("docid", subID)), 1).TotalHits);
                     }
                 }
             }
@@ -743,17 +750,17 @@ namespace Lucene.Net.Index
                     }
                 }
             }
-            Assert.IsFalse(doFail);
+            assertFalse(doFail);
 
-            Assert.AreEqual(AddCount.Get() - DelCount.Get(), s.IndexReader.NumDocs, "index=" + Writer.SegString() + " addCount=" + AddCount + " delCount=" + DelCount);
+            assertEquals("index=" + writer.SegString() + " addCount=" + addCount + " delCount=" + delCount, addCount.Get() - delCount.Get(), s.IndexReader.NumDocs);
             ReleaseSearcher(s);
 
-            Writer.Commit();
+            writer.Commit();
 
-            Assert.AreEqual(AddCount.Get() - DelCount.Get(), Writer.NumDocs, "index=" + Writer.SegString() + " addCount=" + AddCount + " delCount=" + DelCount);
+            assertEquals("index=" + writer.SegString() + " addCount=" + addCount + " delCount=" + delCount, addCount.Get() - delCount.Get(), writer.NumDocs);
 
             DoClose();
-            Writer.Dispose(false);
+            writer.Dispose(false);
 
             // Cannot shutdown until after writer is closed because
             // writer has merged segment warmer that uses IS to run
@@ -764,23 +771,23 @@ namespace Lucene.Net.Index
               es.awaitTermination(1, TimeUnit.SECONDS);
             }*/
 
-            TestUtil.CheckIndex(Dir);
-            Dir.Dispose();
+            TestUtil.CheckIndex(dir);
+            dir.Dispose();
             System.IO.Directory.Delete(tempDir.FullName, true);
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: done [" + (DateTime.UtcNow - t0).TotalMilliseconds + " ms]");
+                Console.WriteLine("TEST: done [" + (Environment.TickCount - t0) + " ms]");
             }
         }
 
         private class IndexReaderWarmerAnonymousInnerClassHelper : IndexWriter.IndexReaderWarmer
         {
-            private readonly ThreadedIndexingAndSearchingTestCase OuterInstance;
+            private readonly ThreadedIndexingAndSearchingTestCase outerInstance;
 
             public IndexReaderWarmerAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance)
             {
-                this.OuterInstance = outerInstance;
+                this.outerInstance = outerInstance;
             }
 
             public override void Warm(AtomicReader reader)
@@ -789,7 +796,7 @@ namespace Lucene.Net.Index
                 {
                     Console.WriteLine("TEST: now warm merged reader=" + reader);
                 }
-                OuterInstance.Warmed[(SegmentCoreReaders)reader.CoreCacheKey] = true;
+                outerInstance.warmed[((SegmentReader)reader).core] = true;
                 int maxDoc = reader.MaxDoc;
                 IBits liveDocs = reader.LiveDocs;
                 int sum = 0;
@@ -803,7 +810,7 @@ namespace Lucene.Net.Index
                     }
                 }
 
-                IndexSearcher searcher = OuterInstance.NewSearcher(reader);
+                IndexSearcher searcher = outerInstance.NewSearcher(reader);
                 sum += searcher.Search(new TermQuery(new Term("body", "united")), 10).TotalHits;
 
                 if (VERBOSE)
@@ -815,12 +822,12 @@ namespace Lucene.Net.Index
 
         private class PrintStreamInfoStreamAnonymousInnerClassHelper : PrintStreamInfoStream
         {
-            private readonly ThreadedIndexingAndSearchingTestCase OuterInstance;
+            private readonly ThreadedIndexingAndSearchingTestCase outerInstance;
 
             public PrintStreamInfoStreamAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance, TextWriter @out)
                 : base(@out)
             {
-                this.OuterInstance = outerInstance;
+                this.outerInstance = outerInstance;
             }
 
             public override void Message(string component, string message)
@@ -841,7 +848,7 @@ namespace Lucene.Net.Index
             {
                 Sort dvSort = new Sort(new SortField("title", SortFieldType.STRING));
                 int hitCount2 = s.Search(q, null, 10, dvSort).TotalHits;
-                Assert.AreEqual(hitCount, hitCount2);
+                assertEquals(hitCount, hitCount2);
             }
             return hitCount;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7eeaca9b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
index 081a1ed..3c811f3 100644
--- a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
@@ -45,13 +45,13 @@ namespace Lucene.Net.Index
             UseNonNrtReaders = Random().NextBoolean();
         }
 
-        protected internal override void DoSearching(TaskScheduler es, DateTime stopTime)
+        protected internal override void DoSearching(TaskScheduler es, long stopTime)
         {
             bool anyOpenDelFiles = false;
 
-            DirectoryReader r = DirectoryReader.Open(Writer, true);
+            DirectoryReader r = DirectoryReader.Open(writer, true);
 
-            while (DateTime.UtcNow < stopTime && !Failed.Get())
+            while (Environment.TickCount < stopTime && !failed.Get())
             {
                 if (Random().NextBoolean())
                 {
@@ -73,8 +73,8 @@ namespace Lucene.Net.Index
                         Console.WriteLine("TEST: now close reader=" + r);
                     }
                     r.Dispose();
-                    Writer.Commit();
-                    ISet<string> openDeletedFiles = ((MockDirectoryWrapper)Dir).OpenDeletedFiles;
+                    writer.Commit();
+                    ISet<string> openDeletedFiles = ((MockDirectoryWrapper)dir).OpenDeletedFiles;
                     if (openDeletedFiles.Count > 0)
                     {
                         Console.WriteLine("OBD files: " + openDeletedFiles);
@@ -85,7 +85,7 @@ namespace Lucene.Net.Index
                     {
                         Console.WriteLine("TEST: now open");
                     }
-                    r = DirectoryReader.Open(Writer, true);
+                    r = DirectoryReader.Open(writer, true);
                 }
                 if (VERBOSE)
                 {
@@ -98,13 +98,13 @@ namespace Lucene.Net.Index
                 {
                     FixedSearcher = new IndexSearcher(r, es);
                     SmokeTestSearcher(FixedSearcher);
-                    RunSearchThreads(DateTime.UtcNow.AddMilliseconds(500));
+                    RunSearchThreads(Environment.TickCount + 500);
                 }
             }
             r.Dispose();
 
             //System.out.println("numDocs=" + r.NumDocs + " openDelFileCount=" + dir.openDeleteFileCount());
-            ISet<string> openDeletedFiles_ = ((MockDirectoryWrapper)Dir).OpenDeletedFiles;
+            ISet<string> openDeletedFiles_ = ((MockDirectoryWrapper)dir).OpenDeletedFiles;
             if (openDeletedFiles_.Count > 0)
             {
                 Console.WriteLine("OBD files: " + openDeletedFiles_);
@@ -129,7 +129,7 @@ namespace Lucene.Net.Index
             // Force writer to do reader pooling, always, so that
             // all merged segments, even for merges before
             // doSearching is called, are warmed:
-            Writer.GetReader().Dispose();
+            writer.GetReader().Dispose();
         }
 
         private IndexSearcher FixedSearcher;
@@ -160,17 +160,17 @@ namespace Lucene.Net.Index
                 {
                     if (Random().NextBoolean())
                     {
-                        r2 = Writer.GetReader();
+                        r2 = writer.GetReader();
                     }
                     else
                     {
-                        Writer.Commit();
-                        r2 = DirectoryReader.Open(Dir);
+                        writer.Commit();
+                        r2 = DirectoryReader.Open(dir);
                     }
                 }
                 else
                 {
-                    r2 = Writer.GetReader();
+                    r2 = writer.GetReader();
                 }
                 return NewSearcher(r2);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7eeaca9b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
index 8fac262..a9ed1e8 100644
--- a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
+++ b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
@@ -61,18 +61,18 @@ namespace Lucene.Net.Search
     {
 
         // Not guaranteed to reflect deletes:
-        private SearcherManager NrtNoDeletes;
+        private SearcherManager nrtNoDeletes;
 
         // Is guaranteed to reflect deletes:
-        private SearcherManager NrtDeletes;
+        private SearcherManager nrtDeletes;
 
-        private TrackingIndexWriter GenWriter;
+        private TrackingIndexWriter genWriter;
 
-        private ControlledRealTimeReopenThread<IndexSearcher> NrtDeletesThread;
-        private ControlledRealTimeReopenThread<IndexSearcher> NrtNoDeletesThread;
+        private ControlledRealTimeReopenThread<IndexSearcher> nrtDeletesThread;
+        private ControlledRealTimeReopenThread<IndexSearcher> nrtNoDeletesThread;
 
-        private readonly ThreadLocal<long?> LastGens = new ThreadLocal<long?>();
-        private bool WarmCalled;
+        private readonly ThreadLocal<long?> lastGens = new ThreadLocal<long?>();
+        private bool warmCalled;
 
         [Test]
         public virtual void TestControlledRealTimeReopenThread_Mem()
@@ -88,8 +88,8 @@ namespace Lucene.Net.Search
                 {
                     Console.WriteLine("TEST: finalSearcher maxGen=" + MaxGen);
                 }
-                NrtDeletesThread.WaitForGeneration(MaxGen);
-                return NrtDeletes.Acquire();
+                nrtDeletesThread.WaitForGeneration(MaxGen);
+                return nrtDeletes.Acquire();
             }
         }
 
@@ -113,7 +113,7 @@ namespace Lucene.Net.Search
 
         protected internal override void UpdateDocuments(Term id, IEnumerable<IEnumerable<IIndexableField>> docs)
         {
-            long gen = GenWriter.UpdateDocuments(id, docs);
+            long gen = genWriter.UpdateDocuments(id, docs);
 
             // Randomly verify the update "took":
             if (Random().Next(20) == 2)
@@ -122,29 +122,29 @@ namespace Lucene.Net.Search
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: verify " + id);
                 }
-                NrtDeletesThread.WaitForGeneration(gen);
-                IndexSearcher s = NrtDeletes.Acquire();
+                nrtDeletesThread.WaitForGeneration(gen);
+                IndexSearcher s = nrtDeletes.Acquire();
                 if (VERBOSE)
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: got searcher=" + s);
                 }
                 try
                 {
-                    Assert.AreEqual(docs.Count(), s.Search(new TermQuery(id), 10).TotalHits);
+                    assertEquals(docs.Count(), s.Search(new TermQuery(id), 10).TotalHits);
                 }
                 finally
                 {
-                    NrtDeletes.Release(s);
+                    nrtDeletes.Release(s);
                 }
             }
 
-            LastGens.Value = gen;
+            lastGens.Value = gen;
 
         }
 
         protected internal override void AddDocuments(Term id, IEnumerable<IEnumerable<IIndexableField>> docs)
         {
-            long gen = GenWriter.AddDocuments(docs);
+            long gen = genWriter.AddDocuments(docs);
             // Randomly verify the add "took":
             if (Random().Next(20) == 2)
             {
@@ -152,27 +152,27 @@ namespace Lucene.Net.Search
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: verify " + id);
                 }
-                NrtNoDeletesThread.WaitForGeneration(gen);
-                IndexSearcher s = NrtNoDeletes.Acquire();
+                nrtNoDeletesThread.WaitForGeneration(gen);
+                IndexSearcher s = nrtNoDeletes.Acquire();
                 if (VERBOSE)
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: got searcher=" + s);
                 }
                 try
                 {
-                    Assert.AreEqual(docs.Count(), s.Search(new TermQuery(id), 10).TotalHits);
+                    assertEquals(docs.Count(), s.Search(new TermQuery(id), 10).TotalHits);
                 }
                 finally
                 {
-                    NrtNoDeletes.Release(s);
+                    nrtNoDeletes.Release(s);
                 }
             }
-            LastGens.Value = gen;
+            lastGens.Value = gen;
         }
 
         protected internal override void AddDocument(Term id, IEnumerable<IIndexableField> doc)
         {
-            long gen = GenWriter.AddDocument(doc);
+            long gen = genWriter.AddDocument(doc);
 
             // Randomly verify the add "took":
             if (Random().Next(20) == 2)
@@ -181,27 +181,27 @@ namespace Lucene.Net.Search
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: verify " + id);
                 }
-                NrtNoDeletesThread.WaitForGeneration(gen);
-                IndexSearcher s = NrtNoDeletes.Acquire();
+                nrtNoDeletesThread.WaitForGeneration(gen);
+                IndexSearcher s = nrtNoDeletes.Acquire();
                 if (VERBOSE)
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: got searcher=" + s);
                 }
                 try
                 {
-                    Assert.AreEqual(1, s.Search(new TermQuery(id), 10).TotalHits);
+                    assertEquals(1, s.Search(new TermQuery(id), 10).TotalHits);
                 }
                 finally
                 {
-                    NrtNoDeletes.Release(s);
+                    nrtNoDeletes.Release(s);
                 }
             }
-            LastGens.Value = gen;
+            lastGens.Value = gen;
         }
 
         protected internal override void UpdateDocument(Term id, IEnumerable<IIndexableField> doc)
         {
-            long gen = GenWriter.UpdateDocument(id, doc);
+            long gen = genWriter.UpdateDocument(id, doc);
             // Randomly verify the udpate "took":
             if (Random().Next(20) == 2)
             {
@@ -209,27 +209,27 @@ namespace Lucene.Net.Search
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: verify " + id);
                 }
-                NrtDeletesThread.WaitForGeneration(gen);
-                IndexSearcher s = NrtDeletes.Acquire();
+                nrtDeletesThread.WaitForGeneration(gen);
+                IndexSearcher s = nrtDeletes.Acquire();
                 if (VERBOSE)
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: got searcher=" + s);
                 }
                 try
                 {
-                    Assert.AreEqual(1, s.Search(new TermQuery(id), 10).TotalHits);
+                    assertEquals(1, s.Search(new TermQuery(id), 10).TotalHits);
                 }
                 finally
                 {
-                    NrtDeletes.Release(s);
+                    nrtDeletes.Release(s);
                 }
             }
-            LastGens.Value = gen;
+            lastGens.Value = gen;
         }
 
         protected internal override void DeleteDocuments(Term id)
         {
-            long gen = GenWriter.DeleteDocuments(id);
+            long gen = genWriter.DeleteDocuments(id);
             // randomly verify the delete "took":
             if (Random().Next(20) == 7)
             {
@@ -237,22 +237,22 @@ namespace Lucene.Net.Search
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: verify del " + id);
                 }
-                NrtDeletesThread.WaitForGeneration(gen);
-                IndexSearcher s = NrtDeletes.Acquire();
+                nrtDeletesThread.WaitForGeneration(gen);
+                IndexSearcher s = nrtDeletes.Acquire();
                 if (VERBOSE)
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": nrt: got searcher=" + s);
                 }
                 try
                 {
-                    Assert.AreEqual(0, s.Search(new TermQuery(id), 10).TotalHits);
+                    assertEquals(0, s.Search(new TermQuery(id), 10).TotalHits);
                 }
                 finally
                 {
-                    NrtDeletes.Release(s);
+                    nrtDeletes.Release(s);
                 }
             }
-            LastGens.Value = gen;
+            lastGens.Value = gen;
         }
 
         protected internal override void DoAfterWriter(TaskScheduler es)
@@ -265,42 +265,42 @@ namespace Lucene.Net.Search
                 Console.WriteLine("TEST: make SearcherManager maxReopenSec=" + maxReopenSec + " minReopenSec=" + minReopenSec);
             }
 
-            GenWriter = new TrackingIndexWriter(Writer);
+            genWriter = new TrackingIndexWriter(writer);
 
             SearcherFactory sf = new SearcherFactoryAnonymousInnerClassHelper(this, es);
 
-            NrtNoDeletes = new SearcherManager(Writer, false, sf);
-            NrtDeletes = new SearcherManager(Writer, true, sf);
+            nrtNoDeletes = new SearcherManager(writer, false, sf);
+            nrtDeletes = new SearcherManager(writer, true, sf);
 
-            NrtDeletesThread = new ControlledRealTimeReopenThread<IndexSearcher>(GenWriter, NrtDeletes, maxReopenSec, minReopenSec);
-            NrtDeletesThread.Name = "NRTDeletes Reopen Thread";
-            NrtDeletesThread.Priority = (ThreadPriority)Math.Min((int)Thread.CurrentThread.Priority + 2, (int)ThreadPriority.Highest);
-            NrtDeletesThread.SetDaemon(true);
-            NrtDeletesThread.Start();
+            nrtDeletesThread = new ControlledRealTimeReopenThread<IndexSearcher>(genWriter, nrtDeletes, maxReopenSec, minReopenSec);
+            nrtDeletesThread.Name = "NRTDeletes Reopen Thread";
+            nrtDeletesThread.Priority = (ThreadPriority)Math.Min((int)Thread.CurrentThread.Priority + 2, (int)ThreadPriority.Highest);
+            nrtDeletesThread.SetDaemon(true);
+            nrtDeletesThread.Start();
 
-            NrtNoDeletesThread = new ControlledRealTimeReopenThread<IndexSearcher>(GenWriter, NrtNoDeletes, maxReopenSec, minReopenSec);
-            NrtNoDeletesThread.Name = "NRTNoDeletes Reopen Thread";
-            NrtNoDeletesThread.Priority = (ThreadPriority)Math.Min((int)Thread.CurrentThread.Priority + 2, (int)ThreadPriority.Highest);
-            NrtNoDeletesThread.SetDaemon(true);
-            NrtNoDeletesThread.Start();
+            nrtNoDeletesThread = new ControlledRealTimeReopenThread<IndexSearcher>(genWriter, nrtNoDeletes, maxReopenSec, minReopenSec);
+            nrtNoDeletesThread.Name = "NRTNoDeletes Reopen Thread";
+            nrtNoDeletesThread.Priority = (ThreadPriority)Math.Min((int)Thread.CurrentThread.Priority + 2, (int)ThreadPriority.Highest);
+            nrtNoDeletesThread.SetDaemon(true);
+            nrtNoDeletesThread.Start();
         }
 
         private class SearcherFactoryAnonymousInnerClassHelper : SearcherFactory
         {
-            private readonly TestControlledRealTimeReopenThread OuterInstance;
+            private readonly TestControlledRealTimeReopenThread outerInstance;
 
-            private TaskScheduler Es;
+            private TaskScheduler es;
 
             public SearcherFactoryAnonymousInnerClassHelper(TestControlledRealTimeReopenThread outerInstance, TaskScheduler es)
             {
-                this.OuterInstance = outerInstance;
-                this.Es = es;
+                this.outerInstance = outerInstance;
+                this.es = es;
             }
 
             public override IndexSearcher NewSearcher(IndexReader r)
             {
-                OuterInstance.WarmCalled = true;
-                IndexSearcher s = new IndexSearcher(r, Es);
+                outerInstance.warmCalled = true;
+                IndexSearcher s = new IndexSearcher(r, es);
                 s.Search(new TermQuery(new Term("body", "united")), 10);
                 return s;
             }
@@ -308,7 +308,7 @@ namespace Lucene.Net.Search
 
         protected internal override void DoAfterIndexingThreadDone()
         {
-            long? gen = LastGens.Value;
+            long? gen = lastGens.Value;
             if (gen != null)
             {
                 AddMaxGen((long)gen);
@@ -325,7 +325,7 @@ namespace Lucene.Net.Search
             }
         }
 
-        protected internal override void DoSearching(TaskScheduler es, DateTime stopTime)
+        protected internal override void DoSearching(TaskScheduler es, long stopTime)
         {
             RunSearchThreads(stopTime);
         }
@@ -339,11 +339,11 @@ namespace Lucene.Net.Search
                 SearcherManager nrt;
                 if (Random().NextBoolean())
                 {
-                    nrt = NrtDeletes;
+                    nrt = nrtDeletes;
                 }
                 else
                 {
-                    nrt = NrtNoDeletes;
+                    nrt = nrtNoDeletes;
                 }
 
                 return nrt.Acquire();
@@ -356,20 +356,20 @@ namespace Lucene.Net.Search
             // against the same SearcherManager you acquired from... but
             // both impls just decRef the underlying reader so we
             // can get away w/ cheating:
-            NrtNoDeletes.Release(s);
+            nrtNoDeletes.Release(s);
         }
 
         protected internal override void DoClose()
         {
-            Assert.IsTrue(WarmCalled);
+            Assert.IsTrue(warmCalled);
             if (VERBOSE)
             {
                 Console.WriteLine("TEST: now close SearcherManagers");
             }
-            NrtDeletesThread.Dispose();
-            NrtDeletes.Dispose();
-            NrtNoDeletesThread.Dispose();
-            NrtNoDeletes.Dispose();
+            nrtDeletesThread.Dispose();
+            nrtDeletes.Dispose();
+            nrtNoDeletesThread.Dispose();
+            nrtNoDeletes.Dispose();
         }
 
         /*
@@ -397,15 +397,15 @@ namespace Lucene.Net.Search
             manager.MaybeRefresh();
             ThreadClass t = new ThreadAnonymousInnerClassHelper(this, latch, signal, writer, manager);
             t.Start();
-            _writer.WaitAfterUpdate = true; // wait in addDocument to let some reopens go through
+            _writer.waitAfterUpdate = true; // wait in addDocument to let some reopens go through
             long lastGen = writer.UpdateDocument(new Term("foo", "bar"), doc); // once this returns the doc is already reflected in the last reopen
 
-            Assert.IsFalse(manager.IsSearcherCurrent()); // false since there is a delete in the queue
+            assertFalse(manager.IsSearcherCurrent()); // false since there is a delete in the queue
 
             IndexSearcher searcher = manager.Acquire();
             try
             {
-                Assert.AreEqual(2, searcher.IndexReader.NumDocs);
+                assertEquals(2, searcher.IndexReader.NumDocs);
             }
             finally
             {
@@ -426,7 +426,7 @@ namespace Lucene.Net.Search
             if (!finished.Get())
             {
                 waiter.Interrupt();
-                Assert.Fail("thread deadlocked on waitForGeneration");
+                fail("thread deadlocked on waitForGeneration");
             }
             thread.Dispose();
             thread.Join();
@@ -435,30 +435,30 @@ namespace Lucene.Net.Search
 
         private class ThreadAnonymousInnerClassHelper : ThreadClass
         {
-            private readonly TestControlledRealTimeReopenThread OuterInstance;
+            private readonly TestControlledRealTimeReopenThread outerInstance;
 
-            private CountdownEvent Latch;
-            private CountdownEvent Signal;
-            private TrackingIndexWriter Writer;
-            private SearcherManager Manager;
+            private CountdownEvent latch;
+            private CountdownEvent signal;
+            private TrackingIndexWriter writer;
+            private SearcherManager manager;
 
             public ThreadAnonymousInnerClassHelper(TestControlledRealTimeReopenThread outerInstance, CountdownEvent latch, CountdownEvent signal, TrackingIndexWriter writer, SearcherManager manager)
             {
-                this.OuterInstance = outerInstance;
-                this.Latch = latch;
-                this.Signal = signal;
-                this.Writer = writer;
-                this.Manager = manager;
+                this.outerInstance = outerInstance;
+                this.latch = latch;
+                this.signal = signal;
+                this.writer = writer;
+                this.manager = manager;
             }
 
             public override void Run()
             {
                 try
                 {
-                    Signal.Wait();
-                    Manager.MaybeRefresh();
-                    Writer.DeleteDocuments(new TermQuery(new Term("foo", "barista")));
-                    Manager.MaybeRefresh(); // kick off another reopen so we inc. the internal gen
+                    signal.Wait();
+                    manager.MaybeRefresh();
+                    writer.DeleteDocuments(new TermQuery(new Term("foo", "barista")));
+                    manager.MaybeRefresh(); // kick off another reopen so we inc. the internal gen
                 }
                 catch (Exception e)
                 {
@@ -467,54 +467,54 @@ namespace Lucene.Net.Search
                 }
                 finally
                 {
-                    Latch.Reset(Latch.CurrentCount == 0 ? 0 : Latch.CurrentCount - 1); // let the add below finish
+                    latch.Reset(latch.CurrentCount == 0 ? 0 : latch.CurrentCount - 1); // let the add below finish
                 }
             }
         }
 
         private class ThreadAnonymousInnerClassHelper2 : ThreadClass
         {
-            private readonly TestControlledRealTimeReopenThread OuterInstance;
+            private readonly TestControlledRealTimeReopenThread outerInstance;
 
-            private long LastGen;
+            private long lastGen;
             private ControlledRealTimeReopenThread<IndexSearcher> thread;
-            private AtomicBoolean Finished;
+            private AtomicBoolean finished;
 
             public ThreadAnonymousInnerClassHelper2(TestControlledRealTimeReopenThread outerInstance, long lastGen, ControlledRealTimeReopenThread<IndexSearcher> thread, AtomicBoolean finished)
             {
-                this.OuterInstance = outerInstance;
-                this.LastGen = lastGen;
+                this.outerInstance = outerInstance;
+                this.lastGen = lastGen;
                 this.thread = thread;
-                this.Finished = finished;
+                this.finished = finished;
             }
 
             public override void Run()
             {
                 try
                 {
-                    thread.WaitForGeneration(LastGen);
+                    thread.WaitForGeneration(lastGen);
                 }
                 catch (ThreadInterruptedException ie)
                 {
                     Thread.CurrentThread.Interrupt();
                     throw new Exception(ie.Message, ie);
                 }
-                Finished.Set(true);
+                finished.Set(true);
             }
         }
 
         public class LatchedIndexWriter : IndexWriter
         {
 
-            internal CountdownEvent Latch;
-            internal bool WaitAfterUpdate = false;
-            internal CountdownEvent Signal;
+            internal CountdownEvent latch;
+            internal bool waitAfterUpdate = false;
+            internal CountdownEvent signal;
 
             public LatchedIndexWriter(Directory d, IndexWriterConfig conf, CountdownEvent latch, CountdownEvent signal)
                 : base(d, conf)
             {
-                this.Latch = latch;
-                this.Signal = signal;
+                this.latch = latch;
+                this.signal = signal;
 
             }
 
@@ -523,10 +523,10 @@ namespace Lucene.Net.Search
                 base.UpdateDocument(term, doc, analyzer);
                 try
                 {
-                    if (WaitAfterUpdate)
+                    if (waitAfterUpdate)
                     {
-                        Signal.Reset(Signal.CurrentCount == 0 ? 0 : Signal.CurrentCount - 1);
-                        Latch.Wait();
+                        signal.Reset(signal.CurrentCount == 0 ? 0 : signal.CurrentCount - 1);
+                        latch.Wait();
                     }
                 }
 #pragma warning disable 168
@@ -552,7 +552,7 @@ namespace Lucene.Net.Search
             try
             {
                 new SearcherManager(w.w, false, theEvilOne);
-                Assert.Fail("didn't hit expected exception");
+                fail("didn't hit expected exception");
             }
 #pragma warning disable 168
             catch (InvalidOperationException ise)
@@ -593,9 +593,9 @@ namespace Lucene.Net.Search
             sm.AddListener(new RefreshListenerAnonymousInnerClassHelper(this, afterRefreshCalled));
             iw.AddDocument(new Document());
             iw.Commit();
-            Assert.IsFalse(afterRefreshCalled.Get());
+            assertFalse(afterRefreshCalled.Get());
             sm.MaybeRefreshBlocking();
-            Assert.IsTrue(afterRefreshCalled.Get());
+            assertTrue(afterRefreshCalled.Get());
             sm.Dispose();
             iw.Dispose();
             dir.Dispose();
@@ -603,14 +603,14 @@ namespace Lucene.Net.Search
 
         private class RefreshListenerAnonymousInnerClassHelper : ReferenceManager.IRefreshListener
         {
-            private readonly TestControlledRealTimeReopenThread OuterInstance;
+            private readonly TestControlledRealTimeReopenThread outerInstance;
 
-            private AtomicBoolean AfterRefreshCalled;
+            private AtomicBoolean afterRefreshCalled;
 
             public RefreshListenerAnonymousInnerClassHelper(TestControlledRealTimeReopenThread outerInstance, AtomicBoolean afterRefreshCalled)
             {
-                this.OuterInstance = outerInstance;
-                this.AfterRefreshCalled = afterRefreshCalled;
+                this.outerInstance = outerInstance;
+                this.afterRefreshCalled = afterRefreshCalled;
             }
 
             public void BeforeRefresh()
@@ -620,7 +620,7 @@ namespace Lucene.Net.Search
             {
                 if (didRefresh)
                 {
-                    AfterRefreshCalled.Set(true);
+                    afterRefreshCalled.Set(true);
                 }
             }
         }
@@ -656,7 +656,8 @@ namespace Lucene.Net.Search
             IndexWriter iw = new IndexWriter(dir, config);
             SearcherManager sm = new SearcherManager(iw, true, new SearcherFactory());
             TrackingIndexWriter tiw = new TrackingIndexWriter(iw);
-            ControlledRealTimeReopenThread<IndexSearcher> controlledRealTimeReopenThread = new ControlledRealTimeReopenThread<IndexSearcher>(tiw, sm, maxStaleSecs, 0);
+            ControlledRealTimeReopenThread<IndexSearcher> controlledRealTimeReopenThread = 
+                new ControlledRealTimeReopenThread<IndexSearcher>(tiw, sm, maxStaleSecs, 0);
 
             controlledRealTimeReopenThread.SetDaemon(true);
             controlledRealTimeReopenThread.Start();
@@ -674,15 +675,15 @@ namespace Lucene.Net.Search
                 Document d = new Document();
                 d.Add(new TextField("count", i + "", Field.Store.NO));
                 d.Add(new TextField("content", content, Field.Store.YES));
-                long start = DateTime.Now.Millisecond;
+                long start = Environment.TickCount;
                 long l = tiw.AddDocument(d);
                 controlledRealTimeReopenThread.WaitForGeneration(l);
-                long wait = DateTime.Now.Millisecond - start;
-                Assert.IsTrue(wait < (maxStaleSecs * 1000), "waited too long for generation " + wait);
+                long wait = Environment.TickCount - start;
+                assertTrue("waited too long for generation " + wait, wait < (maxStaleSecs * 1000));
                 IndexSearcher searcher = sm.Acquire();
                 TopDocs td = searcher.Search(new TermQuery(new Term("count", i + "")), 10);
                 sm.Release(searcher);
-                Assert.AreEqual(1, td.TotalHits);
+                assertEquals(1, td.TotalHits);
             }
 
             foreach (ThreadClass commitThread in commitThreads)
@@ -698,36 +699,36 @@ namespace Lucene.Net.Search
 
         private class RunnableAnonymousInnerClassHelper : ThreadClass
         {
-            private readonly TestControlledRealTimeReopenThread OuterInstance;
+            private readonly TestControlledRealTimeReopenThread outerInstance;
 
-            private SnapshotDeletionPolicy Sdp;
-            private Directory Dir;
-            private IndexWriter Iw;
+            private SnapshotDeletionPolicy sdp;
+            private Directory dir;
+            private IndexWriter iw;
 
             public RunnableAnonymousInnerClassHelper(TestControlledRealTimeReopenThread outerInstance, SnapshotDeletionPolicy sdp, Directory dir, IndexWriter iw)
             {
-                this.OuterInstance = outerInstance;
-                this.Sdp = sdp;
-                this.Dir = dir;
-                this.Iw = iw;
+                this.outerInstance = outerInstance;
+                this.sdp = sdp;
+                this.dir = dir;
+                this.iw = iw;
             }
 
             public override void Run()
             {
                 try
                 {
-                    Iw.Commit();
-                    IndexCommit ic = Sdp.Snapshot();
+                    iw.Commit();
+                    IndexCommit ic = sdp.Snapshot();
                     foreach (string name in ic.FileNames)
                     {
                         //distribute, and backup
                         //System.out.println(names);
-                        Assert.IsTrue(SlowFileExists(Dir, name));
+                        assertTrue(SlowFileExists(dir, name));
                     }
                 }
                 catch (Exception e)
                 {
-                    throw new Exception(e.Message, e);
+                    throw new Exception(e.toString(), e);
                 }
             }
         }


Mime
View raw message