lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [42/46] lucenenet git commit: Changed Close() to IDisposable.Dispose() in Facet.Taxonomy.WriterCache.ITaxonomyWriterCache.
Date Tue, 04 Oct 2016 20:02:12 GMT
Changed Close() to IDisposable.Dispose() in Facet.Taxonomy.WriterCache.ITaxonomyWriterCache.


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

Branch: refs/heads/master
Commit: 49e25039131cb5b2d577e38d60094690f5321155
Parents: 4495810
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Sep 25 23:47:13 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Oct 3 23:32:13 2016 +0700

----------------------------------------------------------------------
 .../Directory/DirectoryTaxonomyWriter.cs        |  2 +-
 .../WriterCache/Cl2oTaxonomyWriterCache.cs      |  2 +-
 .../WriterCache/LruTaxonomyWriterCache.cs       |  9 ++--
 .../Taxonomy/WriterCache/TaxonomyWriterCache.cs | 43 +++++++++-----------
 .../Directory/TestConcurrentFacetedIndexing.cs  |  2 +-
 .../Directory/TestDirectoryTaxonomyWriter.cs    |  2 +-
 6 files changed, 29 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/49e25039/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
index f59337e..7ecfe94 100644
--- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
@@ -381,7 +381,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
                 }
                 if (cache != null)
                 {
-                    cache.Close();
+                    cache.Dispose();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/49e25039/src/Lucene.Net.Facet/Taxonomy/WriterCache/Cl2oTaxonomyWriterCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/Cl2oTaxonomyWriterCache.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/Cl2oTaxonomyWriterCache.cs
index a6f6ff8..6d26448 100644
--- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/Cl2oTaxonomyWriterCache.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/Cl2oTaxonomyWriterCache.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Facet.Taxonomy.WriterCache
             }
         }
 
-        public virtual void Close()
+        public virtual void Dispose()
         {
             lock (this)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/49e25039/src/Lucene.Net.Facet/Taxonomy/WriterCache/LruTaxonomyWriterCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/LruTaxonomyWriterCache.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/LruTaxonomyWriterCache.cs
index 3f6c4dc..abad1ea 100644
--- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/LruTaxonomyWriterCache.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/LruTaxonomyWriterCache.cs
@@ -100,12 +100,15 @@
             }
         }
 
-        public virtual void Close()
+        public virtual void Dispose()
         {
             lock (this)
             {
-                cache.Clear();
-                cache = null;
+                if (cache != null)
+                {
+                    cache.Clear();
+                    cache = null;
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/49e25039/src/Lucene.Net.Facet/Taxonomy/WriterCache/TaxonomyWriterCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/TaxonomyWriterCache.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/TaxonomyWriterCache.cs
index bb2eec8..127e752 100644
--- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/TaxonomyWriterCache.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/TaxonomyWriterCache.cs
@@ -1,26 +1,27 @@
 ´╗┐namespace Lucene.Net.Facet.Taxonomy.WriterCache
 {
+    using System;
     /*
-     * 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.
-     */
+* 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 DirectoryTaxonomyWriter = Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyWriter;
 
     /// <summary>
-    /// ITaxonomyWriterCache is a relatively simple interface for a cache of
+    /// <see cref="ITaxonomyWriterCache"/> is a relatively simple interface for a cache
of
     /// category->ordinal mappings, used in ITaxonomyWriter implementations (such as
     /// <see cref="DirectoryTaxonomyWriter"/>).
     /// <para>
@@ -46,15 +47,9 @@
     /// @lucene.experimental
     /// </para>
     /// </summary>
-    public interface ITaxonomyWriterCache
+    public interface ITaxonomyWriterCache : IDisposable
     {
         /// <summary>
-        /// Let go of whatever resources the cache is holding. After a <see cref="Close()"/>,
-        /// this object can no longer be used.
-        /// </summary>
-        void Close();
-
-        /// <summary>
         /// Lookup a category in the cache, returning its ordinal, or a negative
         /// number if the category is not in the cache.
         /// <para>
@@ -97,7 +92,7 @@
         bool IsFull { get; }
 
         /// <summary>
-        /// Clears the content of the cache. Unlike <see cref="Close()"/>, the caller
can
+        /// Clears the content of the cache. Unlike <see cref="Dispose()"/>, the caller
can
         /// assume that the cache is still operable after this method returns.
         /// </summary>
         void Clear();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/49e25039/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
index abd82f8..30de593 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
             }
 
 
-            public virtual void Close()
+            public virtual void Dispose()
             {
             }
             public virtual int Get(FacetLabel categoryPath)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/49e25039/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
index 4e6dd85..ef6db80 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
 
         private class TaxonomyWriterCacheAnonymousInnerClassHelper : ITaxonomyWriterCache
         {
-            public virtual void Close()
+            public virtual void Dispose()
             {
             }
             public virtual int Get(FacetLabel categoryPath)


Mime
View raw message