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

commit 30efa4454f62fc731141fe6da2e907bdac9c0dc5
Author: Shad Storhaug <[email protected]>
AuthorDate: Thu Feb 6 20:32:01 2020 +0700

    BREAKING: Lucene.Net.Support.Threading: Deleted unused 
DisposableThreadLocalProfiler
---
 .../Support/Threading/TestCloseableThreadLocal.cs  | 116 ---------------------
 .../Threading/CloseableThreadLocalProfiler.cs      |  45 --------
 2 files changed, 161 deletions(-)

diff --git a/src/Lucene.Net.Tests/Support/Threading/TestCloseableThreadLocal.cs 
b/src/Lucene.Net.Tests/Support/Threading/TestCloseableThreadLocal.cs
deleted file mode 100644
index 9f9e573..0000000
--- a/src/Lucene.Net.Tests/Support/Threading/TestCloseableThreadLocal.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-using Lucene.Net.Analysis;
-using Lucene.Net.Attributes;
-using Lucene.Net.Codecs;
-using Lucene.Net.Documents;
-using Lucene.Net.Index;
-using Lucene.Net.Search;
-using Lucene.Net.Store;
-using Lucene.Net.Util;
-using NUnit.Framework;
-using System;
-using Version = Lucene.Net.Util.LuceneVersion;
-
-#pragma warning disable 612, 618
-namespace Lucene.Net.Support.Threading
-{
-    [SuppressCodecs("Lucene3x")] // Suppress non-writable codecs
-    [TestFixture]
-    public class TestCloseableThreadLocal : LuceneTestCase
-    {
-        [Test, LuceneNetSpecific]
-        public void TestMemLeakage()
-        {
-            DisposableThreadLocalProfiler.EnableIDisposableThreadLocalProfiler 
= true;
-
-            int LoopCount = 100;
-            Analyzer[] analyzers = new Analyzer[LoopCount];
-            RAMDirectory[] dirs = new RAMDirectory[LoopCount];
-            IndexWriter[] indexWriters = new IndexWriter[LoopCount];
-
-            System.Threading.Tasks.Parallel.For(0, LoopCount, (i) =>
-                                                                  {
-                                                                      
analyzers[i] = new 
Lucene.Net.Analysis.Standard.StandardAnalyzer(Version.LUCENE_CURRENT);
-                                                                      dirs[i] 
= new RAMDirectory();
-                                                                      var conf 
= new IndexWriterConfig(Version.LUCENE_CURRENT, analyzers[i]);
-                                                                      
indexWriters[i] = new IndexWriter(dirs[i], conf /*analyzers[i], true, 
IndexWriter.MaxFieldLength.UNLIMITED*/);
-                                                                  });
-
-            System.Threading.Tasks.Parallel.For(0, LoopCount, (i) =>
-                                                                  {
-                                                                      Document 
document = new Document();
-                                                                      
document.Add(new Field("field", "some test", Field.Store.NO, 
Field.Index.ANALYZED));
-                                                                      
indexWriters[i].AddDocument(document);
-                                                                  });
-
-            System.Threading.Tasks.Parallel.For(0, LoopCount, (i) =>
-                                                                  {
-                                                                      
analyzers[i].Dispose();
-                                                                      
indexWriters[i].Dispose();
-                                                                  });
-
-            System.Threading.Tasks.Parallel.For(0, LoopCount, (i) =>
-                                                                  {
-                                                                      using 
(IndexReader reader = DirectoryReader.Open(dirs[i]))
-                                                                      {
-                                                                          
IndexSearcher searcher = new IndexSearcher(reader);
-                                                                          
TopDocs d = searcher.Search(new TermQuery(new Term("field", "test")), 10);
-                                                                      }
-                                                                  });
-
-            System.Threading.Tasks.Parallel.For(0, LoopCount, (i) => 
dirs[i].Dispose());
-
-            GC.Collect(GC.MaxGeneration);
-            GC.WaitForPendingFinalizers();
-
-            int aliveObjects = 0;
-            foreach (WeakReference w in 
DisposableThreadLocalProfiler.Instances)
-            {
-                object o = w.Target;
-                if (o != null) aliveObjects++;
-            }
-
-            DisposableThreadLocalProfiler.EnableIDisposableThreadLocalProfiler 
= false;
-
-            Assert.AreEqual(0, aliveObjects);
-        }
-    }
-}
-
-#if NET35
-
-namespace System.Threading.Tasks
-{
-    public static class Parallel
-    {
-        public static void For(int start, int end, Action<int> loopAction)
-        {
-            for(int i = start; i < end; i++)
-            {
-                loopAction(i);
-            }
-        }
-    }
-}
-#pragma warning restore 612, 618
-#endif
\ No newline at end of file
diff --git a/src/Lucene.Net/Support/Threading/CloseableThreadLocalProfiler.cs 
b/src/Lucene.Net/Support/Threading/CloseableThreadLocalProfiler.cs
deleted file mode 100644
index 8423793..0000000
--- a/src/Lucene.Net/Support/Threading/CloseableThreadLocalProfiler.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-using System;
-
-namespace Lucene.Net.Support.Threading
-{
-    /// <summary>
-    /// For Debuging purposes.
-    /// </summary>
-    public class DisposableThreadLocalProfiler
-    {
-        private static bool _enableIDisposableThreadLocalProfiler = false;
-        public static System.Collections.Generic.List<WeakReference> Instances 
= new System.Collections.Generic.List<WeakReference>();
-
-        public static bool EnableIDisposableThreadLocalProfiler
-        {
-            get { return _enableIDisposableThreadLocalProfiler; }
-            set
-            {
-                _enableIDisposableThreadLocalProfiler = value;
-                lock (Instances)
-                    Instances.Clear();
-            }
-        }
-    }
-}
\ No newline at end of file

Reply via email to