You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/03/19 04:01:15 UTC

[lucenenet] branch master updated: Removed use of #If FEATURE_THREAD_INTERRUPT since all supported compilation targets now have definitions for ThreadInterruptedException

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new 921ad11  Removed use of #If FEATURE_THREAD_INTERRUPT since all supported compilation targets now have definitions for ThreadInterruptedException
921ad11 is described below

commit 921ad114b43f5e0cd565c54fb88667fa027d6708
Author: Ron Clabo <ro...@GiftOasis.com>
AuthorDate: Thu Mar 18 17:25:30 2021 -0400

    Removed use of #If FEATURE_THREAD_INTERRUPT since all supported compilation targets now have definitions for ThreadInterruptedException
---
 Directory.Build.targets                            |  1 -
 .../Analysis/BaseTokenStreamTestCase.cs            |  8 +------
 .../Store/SlowClosingMockIndexInputWrapper.cs      |  9 ++------
 .../Store/SlowOpeningMockIndexInputWrapper.cs      |  6 +----
 .../Util/ThrottledIndexOutput.cs                   | 16 ++++---------
 src/Lucene.Net.Tests.Facet/SlowRAMDirectory.cs     | 15 +++---------
 .../Index/TestDocumentsWriterDeleteQueue.cs        | 15 +++---------
 .../Index/TestDocumentsWriterStallControl.cs       |  6 -----
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs      |  4 ----
 .../Index/TestIndexWriterNRTIsCurrent.cs           |  4 ----
 .../Index/TestIndexWriterReader.cs                 | 13 ++---------
 .../Index/TestIndexWriterWithThreads.cs            | 16 ++++---------
 .../Index/TestSnapshotDeletionPolicy.cs            | 16 ++++---------
 .../Search/TestControlledRealTimeReopenThread.cs   | 26 +++++----------------
 src/Lucene.Net.Tests/Search/TestSearcherManager.cs |  8 +------
 .../Search/TestTimeLimitingCollector.cs            | 15 +-----------
 src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs  | 16 ++-----------
 src/Lucene.Net.Tests/Util/TestSetOnce.cs           |  2 --
 src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs   | 20 ++++------------
 .../Index/DocumentsWriterFlushControl.cs           | 14 ++---------
 .../Index/DocumentsWriterStallControl.cs           | 15 +++---------
 src/Lucene.Net/Index/IndexWriter.cs                | 27 ++++------------------
 src/Lucene.Net/Index/MergePolicy.cs                | 21 ++++++++---------
 .../Search/ControlledRealTimeReopenThread.cs       | 24 ++++---------------
 src/Lucene.Net/Search/IndexSearcher.cs             |  4 +---
 src/Lucene.Net/Search/TimeLimitingCollector.cs     | 15 +++---------
 src/Lucene.Net/Store/Lock.cs                       | 17 ++++----------
 src/Lucene.Net/Store/RateLimiter.cs                | 17 ++++----------
 src/Lucene.Net/Support/Index/TaskMergeScheduler.cs | 27 ++++++++--------------
 src/Lucene.Net/Util/IOUtils.cs                     |  6 -----
 30 files changed, 83 insertions(+), 320 deletions(-)

diff --git a/Directory.Build.targets b/Directory.Build.targets
index 64ec9c7..c4be65f 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -71,7 +71,6 @@
     <DefineConstants>$(DefineConstants);FEATURE_STACKTRACE</DefineConstants>
     <DefineConstants>$(DefineConstants);FEATURE_TEXTWRITER_CLOSE</DefineConstants>
     <DefineConstants>$(DefineConstants);FEATURE_TEXTWRITER_INITIALIZELIFETIMESERVICE</DefineConstants>
-    <DefineConstants>$(DefineConstants);FEATURE_THREAD_INTERRUPT</DefineConstants>
     <DefineConstants>$(DefineConstants);FEATURE_THREAD_PRIORITY</DefineConstants>
     <DefineConstants>$(DefineConstants);FEATURE_THREAD_YIELD</DefineConstants>
     <DefineConstants>$(DefineConstants);FEATURE_THREADPOOL_UNSAFEQUEUEWORKITEM</DefineConstants>
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index b526c1d..1ba5485 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -795,20 +795,14 @@ namespace Lucene.Net.Analysis
                 startingGun.Signal();
                 foreach (var t in threads)
                 {
-#if FEATURE_THREAD_INTERRUPT
                     try
                     {
-#endif
                         t.Join();
-#if FEATURE_THREAD_INTERRUPT
                     }
-#pragma warning disable 168
-                    catch (ThreadInterruptedException e)
-#pragma warning restore 168
+                    catch (ThreadInterruptedException)
                     {
                         fail("Thread interrupted");
                     }
-#endif
                 }
 
                 //if (threads.Any(x => x.Failed))
diff --git a/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs b/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
index 189dcde..5e047cb 100644
--- a/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/SlowClosingMockIndexInputWrapper.cs
@@ -1,4 +1,4 @@
-using System.Threading;
+using System.Threading;
 
 namespace Lucene.Net.Store
 {
@@ -40,12 +40,7 @@ namespace Lucene.Net.Store
                 {
                     Thread.Sleep(50);
                 }
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                catch (ThreadInterruptedException ie)
-//                {
-//                    throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-//                }
-//#endif
+                // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
                 finally
                 {
                     base.Dispose(disposing);
diff --git a/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs b/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
index 98921a1..eed0a9f 100644
--- a/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Threading;
 
 namespace Lucene.Net.Store
@@ -29,12 +29,9 @@ namespace Lucene.Net.Store
         public SlowOpeningMockIndexInputWrapper(MockDirectoryWrapper dir, string name, IndexInput @delegate)
             : base(dir, name, @delegate)
         {
-#if FEATURE_THREAD_INTERRUPT
             try
             {
-#endif
                 Thread.Sleep(50);
-#if FEATURE_THREAD_INTERRUPT
             }
             catch (ThreadInterruptedException /*ie*/)
             {
@@ -48,7 +45,6 @@ namespace Lucene.Net.Store
                 //throw new ThreadInterruptedException(ie.ToString(), ie);
                 throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
-#endif
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.TestFramework/Util/ThrottledIndexOutput.cs b/src/Lucene.Net.TestFramework/Util/ThrottledIndexOutput.cs
index 3d9bae3..08aa553 100644
--- a/src/Lucene.Net.TestFramework/Util/ThrottledIndexOutput.cs
+++ b/src/Lucene.Net.TestFramework/Util/ThrottledIndexOutput.cs
@@ -144,18 +144,10 @@ namespace Lucene.Net.Util
             {
                 return;
             }
-//#if FEATURE_THREAD_INTERRUPT
-//            try
-//            {
-//#endif 
-                Thread.Sleep(TimeSpan.FromMilliseconds(ms));
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//            }
-//            catch (ThreadInterruptedException e)
-//            {
-//                throw new ThreadInterruptedException("Thread Interrupted Exception", e);
-//            }
-//#endif
+
+            Thread.Sleep(TimeSpan.FromMilliseconds(ms));
+            // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
+
         }
 
         public override long Length
diff --git a/src/Lucene.Net.Tests.Facet/SlowRAMDirectory.cs b/src/Lucene.Net.Tests.Facet/SlowRAMDirectory.cs
index 6dc1b89..0484433 100644
--- a/src/Lucene.Net.Tests.Facet/SlowRAMDirectory.cs
+++ b/src/Lucene.Net.Tests.Facet/SlowRAMDirectory.cs
@@ -75,18 +75,9 @@ namespace Lucene.Net.Facet
             {
                 sTime = random.Next(sTime);
             }
-//#if FEATURE_THREAD_INTERRUPT
-//            try
-//            {
-//#endif
-                Thread.Sleep(sTime);
-//#if FEATURE_THREAD_INTERRUPT
-//            }
-//            catch (ThreadInterruptedException e) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//            {
-//                throw new ThreadInterruptedException("Thread Interrupted Exception", e);
-//            }
-//#endif
+
+            Thread.Sleep(sTime);
+            // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterDeleteQueue.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterDeleteQueue.cs
index fc77f34..5daaa7d 100644
--- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterDeleteQueue.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterDeleteQueue.cs
@@ -318,18 +318,9 @@ namespace Lucene.Net.Index
 
             public override void Run()
             {
-//#if FEATURE_THREAD_INTERRUPT
-//                try
-//                {
-//#endif
-                    latch.Wait();
-//#if FEATURE_THREAD_INTERRUPT
-//                }
-//                catch (ThreadInterruptedException e) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                {
-//                    throw new ThreadInterruptedException("Thread Interrupted Exception", e);
-//                }
-//#endif
+
+                latch.Wait();
+                // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
 
                 int i = 0;
                 while ((i = index.GetAndIncrement()) < ids.Length)
diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
index 8cb184b..8b3c3b5 100644
--- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
@@ -267,12 +267,9 @@ namespace Lucene.Net.Index
                         ctrl.WaitIfStalled();
                         if (checkPoint)
                         {
-#if FEATURE_THREAD_INTERRUPT
                             try
                             {
-#endif
                                 Assert.IsTrue(sync.await());
-#if FEATURE_THREAD_INTERRUPT
                             }
                             catch (ThreadInterruptedException /*e*/)
                             {
@@ -280,7 +277,6 @@ namespace Lucene.Net.Index
                                 //throw new ThreadInterruptedException("Thread Interrupted Exception", e);
                                 throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
-#endif
                         }
                     }
                 }
@@ -331,14 +327,12 @@ namespace Lucene.Net.Index
                             {
                                 Assert.IsTrue(sync.await());
                             }
-#if FEATURE_THREAD_INTERRUPT
                             catch (ThreadInterruptedException /*e*/)
                             {
                                 Console.WriteLine("[Updater] got interrupted - wait count: " + sync.waiter.CurrentCount);
                                 //throw new ThreadInterruptedException("Thread Interrupted Exception", e);
                                 throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
-#endif
                             catch (Exception e)
                             {
                                 Console.Write("signal failed with : " + e);
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 2303bdd..ac8d91a 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -1335,7 +1335,6 @@ namespace Lucene.Net.Index
                             allowInterrupt = true;
                         }
                     }
-#if FEATURE_THREAD_INTERRUPT
                     catch (ThreadInterruptedException re)
                     {
                         // NOTE: important to leave this verbosity/noise
@@ -1356,7 +1355,6 @@ namespace Lucene.Net.Index
                             break;
                         }
                     }
-#endif
                     catch (Exception t)
                     {
                         Console.WriteLine("FAILED; unexpected exception");
@@ -1380,7 +1378,6 @@ namespace Lucene.Net.Index
                         {
                             w.Rollback();
                         }
-#if FEATURE_THREAD_INTERRUPT
                         // LUCENENET specific - there is a chance that our thread will be
                         // interrupted here, so we need to catch and ignore that exception
                         // when our MockDirectoryWrapper throws it.
@@ -1388,7 +1385,6 @@ namespace Lucene.Net.Index
                         {
                             // ignore
                         }
-#endif
                         catch (IOException ioe)
                         {
                             throw new Exception(ioe.ToString(), ioe);
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs
index 73f2e5d..925a5bc 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs
@@ -199,19 +199,15 @@ namespace Lucene.Net.Index
 
             public override void Run()
             {
-#if FEATURE_THREAD_INTERRUPT
                 try
                 {
-#endif
                     latch.Wait();
-#if FEATURE_THREAD_INTERRUPT
                 }
                 catch (ThreadInterruptedException e)
                 {
                     failed = e;
                     return;
                 }
-#endif
                 DirectoryReader reader;
                 while ((reader = holder.reader) != null)
                 {
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
index 3743e0f..20a1fb0 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
@@ -508,18 +508,9 @@ namespace Lucene.Net.Index
             {
                 for (int i = 0; i < outerInstance.numThreads; i++)
                 {
-//#if FEATURE_THREAD_INTERRUPT
-//                    try
-//                    {
-//#endif
+
                     threads[i].Join();
-//#if FEATURE_THREAD_INTERRUPT
-//                    }
-//                    catch (ThreadInterruptedException ie) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                    {
-//                        throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-//                    }
-//#endif
+                    // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
                 }
             }
 
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
index e3e973a..0fb7708 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
@@ -117,18 +117,10 @@ namespace Lucene.Net.Index
                         if (ioe.Message.StartsWith("fake disk full at", StringComparison.Ordinal) || ioe.Message.Equals("now failing on purpose", StringComparison.Ordinal))
                         {
                             diskFull = true;
-//#if FEATURE_THREAD_INTERRUPT
-//                            try
-//                            {
-//#endif
-                                Thread.Sleep(1);
-//#if FEATURE_THREAD_INTERRUPT
-//                            }
-//                            catch (ThreadInterruptedException ie) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                            {
-//                                throw new ThreadInterruptedException(ie.toString(), ie);
-//                            }
-//#endif
+
+                            Thread.Sleep(1);
+                            // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
+
                             if (fullCount++ >= 5)
                             {
                                 break;
diff --git a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs
index 21f490a..67c8012 100644
--- a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs
@@ -227,18 +227,10 @@ namespace Lucene.Net.Index
                             }
                         }
                     }
-//#if FEATURE_THREAD_INTERRUPT
-//                    try
-//                    {
-//#endif 
-                        Thread.Sleep(1);
-//#if FEATURE_THREAD_INTERRUPT
-//                    }
-//                    catch (ThreadInterruptedException ie) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                    {
-//                        throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-//                    }
-//#endif
+
+                    Thread.Sleep(1);
+                    // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
+
                 } while (Environment.TickCount < stopTime);
             }
         }
diff --git a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
index 3318240..ffe0131 100644
--- a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
+++ b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs
@@ -494,19 +494,15 @@ namespace Lucene.Net.Search
 
             public override void Run()
             {
-#if FEATURE_THREAD_INTERRUPT
                 try
                 {
-#endif
                     thread.WaitForGeneration(lastGen);
-#if FEATURE_THREAD_INTERRUPT
                 }
                 catch (ThreadInterruptedException ie)
                 {
                     Thread.CurrentThread.Interrupt();
                     throw new Exception(ie.Message, ie);
                 }
-#endif
                 finished.Value = true;
             }
         }
@@ -529,22 +525,12 @@ namespace Lucene.Net.Search
             public override void UpdateDocument(Term term, IEnumerable<IIndexableField> doc, Analyzer analyzer)
             {
                 base.UpdateDocument(term, doc, analyzer);
-//#if FEATURE_THREAD_INTERRUPT
-//                try
-//                {
-//#endif
-                    if (waitAfterUpdate)
-                    {
-                        signal.Reset(signal.CurrentCount == 0 ? 0 : signal.CurrentCount - 1);
-                        latch.Wait();
-                    }
-//#if FEATURE_THREAD_INTERRUPT
-//                }
-//                catch (ThreadInterruptedException) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                {
-//                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
-//                }
-//#endif
+                if (waitAfterUpdate)
+                {
+                    signal.Reset(signal.CurrentCount == 0 ? 0 : signal.CurrentCount - 1);
+                    latch.Wait();
+                }
+                // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
             }
         }
 
diff --git a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
index 074096e..45fc8dd 100644
--- a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
@@ -340,24 +340,18 @@ namespace Lucene.Net.Search
 
             public override IndexSearcher NewSearcher(IndexReader r)
             {
-#if FEATURE_THREAD_INTERRUPT
                 try
                 {
-#endif
                     if (triedReopen)
                     {
                         awaitEnterWarm.Signal();
                         awaitClose.Wait();
                     }
-#if FEATURE_THREAD_INTERRUPT
                 }
-#pragma warning disable 168
-                catch (ThreadInterruptedException e)
-#pragma warning restore 168
+                catch (ThreadInterruptedException)
                 {
                     //
                 }
-#endif
                 return new IndexSearcher(r, es);
             }
         }
diff --git a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs
index 1f28bfc..e3cf33f 100644
--- a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs
+++ b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs
@@ -401,21 +401,8 @@ namespace Lucene.Net.Search
                 int docId = doc + docBase;
                 if (slowdown > 0)
                 {
-                    //try
-                    //{
                     ThreadJob.Sleep(slowdown);
-//                    }
-//#if !FEATURE_THREAD_INTERRUPT
-//                    catch (Exception)
-//                    {
-//                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
-//                    }
-//#else
-//                    catch (ThreadInterruptedException) // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                    {
-//                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
-//                    }
-//#endif
+                    // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
                 }
 
                 if (Debugging.AssertsEnabled) Debugging.Assert(docId >= 0," base={0} doc={1}", docBase, doc);
diff --git a/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs b/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs
index 6648516..a3886a3 100644
--- a/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs
+++ b/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs
@@ -54,20 +54,14 @@ namespace Lucene.Net
 
             public override void Run()
             {
-#if FEATURE_THREAD_INTERRUPT
                 try
                 {
-#endif
                     Thread.Sleep(10000);
-#if FEATURE_THREAD_INTERRUPT
                 }
-#pragma warning disable 168
-                catch (ThreadInterruptedException e)
-#pragma warning restore 168
+                catch (ThreadInterruptedException)
                 {
                     // Ignore.
                 }
-#endif
             }
         }
 
@@ -142,19 +136,13 @@ namespace Lucene.Net
         {
             while (true)
             {
-#if FEATURE_THREAD_INTERRUPT
                 try
                 {
-#endif
                     Thread.Sleep(1000);
-#if FEATURE_THREAD_INTERRUPT
                 }
-#pragma warning disable 168
-                catch (ThreadInterruptedException e)
-#pragma warning restore 168
+                catch (ThreadInterruptedException)
                 {
                 }
-#endif
             }
         }
     }
diff --git a/src/Lucene.Net.Tests/Util/TestSetOnce.cs b/src/Lucene.Net.Tests/Util/TestSetOnce.cs
index a2369ec..af81729 100644
--- a/src/Lucene.Net.Tests/Util/TestSetOnce.cs
+++ b/src/Lucene.Net.Tests/Util/TestSetOnce.cs
@@ -56,12 +56,10 @@ namespace Lucene.Net.Util
                     set.Set(new Integer(Convert.ToInt32(Name.Substring(2), CultureInfo.InvariantCulture)));
                     success = true;
                 }
-#if FEATURE_THREAD_INTERRUPT
                 catch (ThreadInterruptedException)
                 {
                     // ignore
                 }
-#endif
                 catch (Exception)
                 {
                     // TODO: change exception type
diff --git a/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs b/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
index fde368d..9ee0d8b 100644
--- a/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
+++ b/src/Lucene.Net.Tests/Util/TestWeakIdentityMap.cs
@@ -1,4 +1,4 @@
-// LUCENENET specific - factored out this WeakIdentityMap<TKey, TValue> and replaced it with ConditionalWeakTable<TKey, TValue>.
+// LUCENENET specific - factored out this WeakIdentityMap<TKey, TValue> and replaced it with ConditionalWeakTable<TKey, TValue>.
 // ConditionalWeakTable<TKey, TValue> is thread-safe and internally uses RuntimeHelpers.GetHashCode()
 // to lookup the key, so it can be used as a direct replacement for WeakIdentityMap<TKey, TValue>
 // in most cases.
@@ -140,10 +140,8 @@
 //            int size = map.Count;
 //            for (int i = 0; size > 0 && i < 10; i++)
 //            {
-//#if FEATURE_THREAD_INTERRUPT
 //                try
 //                {
-//#endif
 //                    GC.Collect();
 //                    int newSize = map.Count;
 //                    Assert.IsTrue(size >= newSize, "previousSize(" + size + ")>=newSize(" + newSize + ")");
@@ -159,14 +157,11 @@
 //                    Assert.IsTrue(size >= c, "previousSize(" + size + ")>=iteratorSize(" + c + ")");
 //                    Assert.IsTrue(c >= newSize, "iteratorSize(" + c + ")>=newSize(" + newSize + ")");
 //                    size = newSize;
-//#if FEATURE_THREAD_INTERRUPT
 //                }
-//#pragma warning disable 168
-//                catch (ThreadInterruptedException ie)
-//#pragma warning restore 168
+//                catch (ThreadInterruptedException)
 //                {
+//                      //LUCENENET NOTE:  If this class is ever uncommented and used, think through weather we really want to be swallowing the exception here.
 //                }
-//#endif
 //            }
 
 //            map.Clear();
@@ -255,10 +250,8 @@
 //            int size = map.Count;
 //            for (int i = 0; size > 0 && i < 10; i++)
 //            {
-//#if FEATURE_THREAD_INTERRUPT
 //                try
 //                {
-//#endif
 //                    GC.Collect();
 //                    int newSize = map.Count;
 //                    Assert.IsTrue(size >= newSize, "previousSize(" + size + ")>=newSize(" + newSize + ")");
@@ -274,14 +267,11 @@
 //                    Assert.IsTrue(size >= c, "previousSize(" + size + ")>=iteratorSize(" + c + ")");
 //                    Assert.IsTrue(c >= newSize, "iteratorSize(" + c + ")>=newSize(" + newSize + ")");
 //                    size = newSize;
-//#if FEATURE_THREAD_INTERRUPT
 //                }
-//#pragma warning disable 168
-//                catch (ThreadInterruptedException ie)
-//#pragma warning restore 168
+//                catch (ThreadInterruptedException)
 //                {
+//                      //LUCENENET NOTE:  If this class is ever uncommented and used, think through weather we really want to be swallowing the exception here.
 //                }
-//#endif
 //            }
 //        }
 
diff --git a/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs b/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs
index 34cb27b..cdd85b3 100644
--- a/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs
+++ b/src/Lucene.Net/Index/DocumentsWriterFlushControl.cs
@@ -1,4 +1,4 @@
-using J2N.Runtime.CompilerServices;
+using J2N.Runtime.CompilerServices;
 using J2N.Threading.Atomic;
 using Lucene.Net.Diagnostics;
 using System;
@@ -313,18 +313,8 @@ namespace Lucene.Net.Index
             {
                 while (flushingWriters.Count != 0)
                 {
-//#if FEATURE_THREAD_INTERRUPT
-//                    try
-//                    {
-//#endif
                     Monitor.Wait(this);
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                    }
-//                    catch (ThreadInterruptedException e)
-//                    {
-//                        throw new ThreadInterruptedException("Thread Interrupted Exception", e);
-//                    }
-//#endif
+                    // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
                 }
             }
         }
diff --git a/src/Lucene.Net/Index/DocumentsWriterStallControl.cs b/src/Lucene.Net/Index/DocumentsWriterStallControl.cs
index 4445b8e..77303bc 100644
--- a/src/Lucene.Net/Index/DocumentsWriterStallControl.cs
+++ b/src/Lucene.Net/Index/DocumentsWriterStallControl.cs
@@ -1,4 +1,4 @@
-using J2N.Runtime.CompilerServices;
+using J2N.Runtime.CompilerServices;
 using J2N.Threading;
 using Lucene.Net.Diagnostics;
 using System.Collections.Generic;
@@ -81,10 +81,7 @@ namespace Lucene.Net.Index
                     if (stalled) // react on the first wakeup call!
                     {
                         // don't loop here, higher level logic will re-stall!
-//#if FEATURE_THREAD_INTERRUPT
-//                        try
-//                        {
-//#endif
+
                         // LUCENENET: make sure not to run IncWaiters / DecrWaiters in Debugging.Assert as that gets 
                         // disabled in production
                         var result = IncWaiters();
@@ -92,13 +89,7 @@ namespace Lucene.Net.Index
                         Monitor.Wait(this);
                         result = DecrWaiters();
                         if (Debugging.AssertsEnabled) Debugging.Assert(result);
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                        }
-//                        catch (ThreadInterruptedException e)
-//                        {
-//                            throw new ThreadInterruptedException("Thread Interrupted Exception", e);
-//                        }
-//#endif
+                        // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
                     }
                 }
             }
diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs
index 928251d..de7829b 100644
--- a/src/Lucene.Net/Index/IndexWriter.cs
+++ b/src/Lucene.Net/Index/IndexWriter.cs
@@ -1184,14 +1184,11 @@ namespace Lucene.Net.Index
 
                         if (waitForMerges)
                         {
-#if FEATURE_THREAD_INTERRUPT
                             try
                             {
-#endif    
-                            // Give merge scheduler last chance to run, in case
+                                // Give merge scheduler last chance to run, in case
                                 // any pending merges are waiting:
                                 mergeScheduler.Merge(this, MergeTrigger.CLOSING, false);
-#if FEATURE_THREAD_INTERRUPT
                             }
                             catch (ThreadInterruptedException)
                             {
@@ -1202,20 +1199,16 @@ namespace Lucene.Net.Index
                                     infoStream.Message("IW", "interrupted while waiting for final merges");
                                 }
                             }
-#endif
                         }
 
                         lock (this)
                         {
                             for (; ; )
                             {
-#if FEATURE_THREAD_INTERRUPT
                                 try
                                 {
-#endif
                                     FinishMerges(waitForMerges && !interrupted);
                                     break;
-#if FEATURE_THREAD_INTERRUPT
                                 }
                                 catch (ThreadInterruptedException)
                                 {
@@ -1228,7 +1221,6 @@ namespace Lucene.Net.Index
                                         infoStream.Message("IW", "interrupted while waiting for merges to finish");
                                     }
                                 }
-#endif
                             }
                             stopMerges = true;
                         }
@@ -1301,9 +1293,7 @@ namespace Lucene.Net.Index
                 // finally, restore interrupt status:
                 if (interrupted)
                 {
-#if FEATURE_THREAD_INTERRUPT
                     Thread.CurrentThread.Interrupt();
-#endif
                 }
             }
         }
@@ -5351,18 +5341,9 @@ namespace Lucene.Net.Index
                 // fails to be called, we wait for at most 1 second
                 // and then return so caller can check if wait
                 // conditions are satisfied:
-//#if FEATURE_THREAD_INTERRUPT
-//                try
-//                {
-//#endif
-                    Monitor.Wait(this, TimeSpan.FromMilliseconds(1000));
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                }
-//                catch (ThreadInterruptedException ie)
-//                {
-//                    throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-//                }
-//#endif
+
+                Monitor.Wait(this, TimeSpan.FromMilliseconds(1000));
+                // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
             }
         }
 
diff --git a/src/Lucene.Net/Index/MergePolicy.cs b/src/Lucene.Net/Index/MergePolicy.cs
index d3f1c6e..bac428c 100644
--- a/src/Lucene.Net/Index/MergePolicy.cs
+++ b/src/Lucene.Net/Index/MergePolicy.cs
@@ -286,20 +286,17 @@ namespace Lucene.Net.Index
 
                     while (paused)
                     {
-//#if FEATURE_THREAD_INTERRUPT
-//                        try
-//                        {
-//#endif
-                            // In theory we could wait() indefinitely, but we
+                        try
+                        {
+                            //In theory we could wait() indefinitely, but we
                             // do 1000 msec, defensively
                             Monitor.Wait(this, TimeSpan.FromMilliseconds(1000));
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                        }
-//                        catch (ThreadInterruptedException ie)
-//                        {
-//                            throw new Exception(ie.ToString(), ie);
-//                        }
-//#endif
+                        }
+                        catch (ThreadInterruptedException ie)
+                        {
+                            throw new Exception(ie.ToString(), ie);
+                        }
+
                         if (aborted)
                         {
                             throw new MergeAbortedException("merge is aborted: " + SegString(dir));
diff --git a/src/Lucene.Net/Search/ControlledRealTimeReopenThread.cs b/src/Lucene.Net/Search/ControlledRealTimeReopenThread.cs
index bdbd2c5..690846f 100644
--- a/src/Lucene.Net/Search/ControlledRealTimeReopenThread.cs
+++ b/src/Lucene.Net/Search/ControlledRealTimeReopenThread.cs
@@ -1,4 +1,4 @@
-using J2N.Threading;
+using J2N.Threading;
 using Lucene.Net.Support;
 using System;
 using System.IO;
@@ -136,18 +136,10 @@ namespace Lucene.Net.Search
             {
                 finish = true;
                 reopenCond.Set();
-                //#if FEATURE_THREAD_INTERRUPT
-                //            try
-                //            {
-                //#endif
+                
                 Join();
-                //#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-                //            }
-                //            catch (ThreadInterruptedException ie)
-                //            {
-                //                throw new ThreadInterruptedException(ie.ToString(), ie);
-                //            }
-                //#endif
+                // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
+
                 // LUCENENET specific: dispose reset event
                 reopenCond.Dispose();
                 available.Dispose();
@@ -247,21 +239,15 @@ namespace Lucene.Net.Search
                 long sleepNS = nextReopenStartNS - Time.NanoTime();
 
                 if (sleepNS > 0)
-#if FEATURE_THREAD_INTERRUPT
                     try
                     {
-#endif
                         reopenCond.WaitOne(TimeSpan.FromMilliseconds(sleepNS / Time.MILLISECONDS_PER_NANOSECOND));//Convert NS to Ticks
-#if FEATURE_THREAD_INTERRUPT
                     }
-#pragma warning disable 168
-                    catch (ThreadInterruptedException ie)
-#pragma warning restore 168
+                    catch (ThreadInterruptedException)
                     {
                         Thread.CurrentThread.Interrupt();
                         return;
                     }
-#endif
 
                 if (finish)
                 {
diff --git a/src/Lucene.Net/Search/IndexSearcher.cs b/src/Lucene.Net/Search/IndexSearcher.cs
index bccb823..a0a02ff 100644
--- a/src/Lucene.Net/Search/IndexSearcher.cs
+++ b/src/Lucene.Net/Search/IndexSearcher.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Diagnostics;
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using Lucene.Net.Support.Threading;
 using System;
@@ -878,13 +878,11 @@ namespace Lucene.Net.Search
 
                         return true;
                     }
-#if FEATURE_THREAD_INTERRUPT
                     catch (ThreadInterruptedException /*e*/)
                     {
                         //throw new ThreadInterruptedException(e.ToString(), e);
                         throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
-#endif
                     catch (Exception e)
                     {
                         // LUCENENET NOTE: We need to re-throw this as Exception to 
diff --git a/src/Lucene.Net/Search/TimeLimitingCollector.cs b/src/Lucene.Net/Search/TimeLimitingCollector.cs
index e90f3d2..cbbf842 100644
--- a/src/Lucene.Net/Search/TimeLimitingCollector.cs
+++ b/src/Lucene.Net/Search/TimeLimitingCollector.cs
@@ -303,18 +303,9 @@ namespace Lucene.Net.Search
                 {
                     // TODO: Use System.nanoTime() when Lucene moves to Java SE 5.
                     counter.AddAndGet(resolution);
-//#if FEATURE_THREAD_INTERRUPT
-//                    try
-//                    {
-//#endif
-                        Thread.Sleep(TimeSpan.FromMilliseconds(Interlocked.Read(ref resolution)));
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                    }
-//                    catch (ThreadInterruptedException ie)
-//                    {
-//                        throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-//                    }
-//#endif
+
+                    Thread.Sleep(TimeSpan.FromMilliseconds(Interlocked.Read(ref resolution)));
+                    // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException 
                 }
             }
 
diff --git a/src/Lucene.Net/Store/Lock.cs b/src/Lucene.Net/Store/Lock.cs
index b796d89..78c465c 100644
--- a/src/Lucene.Net/Store/Lock.cs
+++ b/src/Lucene.Net/Store/Lock.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.IO;
 using System.Threading;
 
@@ -136,18 +136,9 @@ namespace Lucene.Net.Store
                     throw e;
                 }
 
-//#if FEATURE_THREAD_INTERRUPT
-//                try
-//                {
-//#endif
-                    Thread.Sleep(TimeSpan.FromMilliseconds(LOCK_POLL_INTERVAL));
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                }
-//                catch (ThreadInterruptedException ie)
-//                {
-//                    throw new ThreadInterruptedException(ie.ToString(), ie);
-//                }
-//#endif
+                Thread.Sleep(TimeSpan.FromMilliseconds(LOCK_POLL_INTERVAL));
+                // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
+
                 locked = Obtain();
             }
             return locked;
diff --git a/src/Lucene.Net/Store/RateLimiter.cs b/src/Lucene.Net/Store/RateLimiter.cs
index fa8121b..07e04ad 100644
--- a/src/Lucene.Net/Store/RateLimiter.cs
+++ b/src/Lucene.Net/Store/RateLimiter.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using Lucene.Net.Support;
 using System;
 using System.Threading;
 
@@ -120,18 +120,9 @@ namespace Lucene.Net.Store
                     var pauseNS = targetNS - curNS;
                     if (pauseNS > 0)
                     {
-//#if FEATURE_THREAD_INTERRUPT
-//                        try
-//                        {
-//#endif
-                            Thread.Sleep(TimeSpan.FromMilliseconds(pauseNS / 1000000));
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//                        }
-//                        catch (ThreadInterruptedException ie)
-//                        {
-//                            throw new ThreadInterruptedException(ie.ToString(), ie);
-//                        }
-//#endif
+                        Thread.Sleep(TimeSpan.FromMilliseconds(pauseNS / 1000000));
+                        // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
+
                         curNS = Time.NanoTime();
                         continue;
                     }
diff --git a/src/Lucene.Net/Support/Index/TaskMergeScheduler.cs b/src/Lucene.Net/Support/Index/TaskMergeScheduler.cs
index 5e19137..c15f303 100644
--- a/src/Lucene.Net/Support/Index/TaskMergeScheduler.cs
+++ b/src/Lucene.Net/Support/Index/TaskMergeScheduler.cs
@@ -370,24 +370,15 @@ namespace Lucene.Net.Index
                 return;
             }
 
-//#if FEATURE_THREAD_INTERRUPT
-//            try
-//            {
-//#endif
-                // When an exception is hit during merge, IndexWriter
-                // removes any partial files and then allows another
-                // merge to run.  If whatever caused the error is not
-                // transient then the exception will keep happening,
-                // so, we sleep here to avoid saturating CPU in such
-                // cases:
-                Thread.Sleep(250);
-//#if FEATURE_THREAD_INTERRUPT // LUCENENET NOTE: Senseless to catch and rethrow the same exception type
-//            }
-//            catch (ThreadInterruptedException ie)
-//            {
-//                throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-//            }
-//#endif
+            // When an exception is hit during merge, IndexWriter
+            // removes any partial files and then allows another
+            // merge to run.  If whatever caused the error is not
+            // transient then the exception will keep happening,
+            // so, we sleep here to avoid saturating CPU in such
+            // cases:
+            Thread.Sleep(250);
+            // LUCENENET NOTE: No need to catch and rethrow same excepton type ThreadInterruptedException
+
             throw new MergePolicy.MergeException(exc, _directory);
         }
 
diff --git a/src/Lucene.Net/Util/IOUtils.cs b/src/Lucene.Net/Util/IOUtils.cs
index ed798cc..f5eff8e 100644
--- a/src/Lucene.Net/Util/IOUtils.cs
+++ b/src/Lucene.Net/Util/IOUtils.cs
@@ -564,21 +564,16 @@ namespace Lucene.Net.Util
         //                    file.Flush(true);
         //                    success = true;
         //                }
-        //#pragma warning disable 168
         //                catch (IOException e)
-        //#pragma warning restore 168
         //                {
         //                    if (retryCount == 5)
         //                    {
         //                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
         //                    }
-        //#if FEATURE_THREAD_INTERRUPT
         //                    try
         //                    {
-        //#endif
         //                        // Pause 5 msec
         //                        Thread.Sleep(5);
-        //#if FEATURE_THREAD_INTERRUPT
         //                    }
         //                    catch (ThreadInterruptedException ie)
         //                    {
@@ -586,7 +581,6 @@ namespace Lucene.Net.Util
         //                        ex.AddSuppressed(e);
         //                        throw ex;
         //                    }
-        //#endif
         //                }
         //                finally
         //                {