lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [20/38] lucenenet git commit: API: Lucene.Net.Index.SegmentReader.ICoreClosedListener: Renamed ICoreDisposedListener, OnClose() > OnDispose()
Date Thu, 22 Jun 2017 05:25:21 GMT
API: Lucene.Net.Index.SegmentReader.ICoreClosedListener: Renamed ICoreDisposedListener, OnClose()
> OnDispose()


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

Branch: refs/heads/master
Commit: 56025d33d39cbd95f97c4882c8a48f55343d736d
Parents: e1d225b
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Jun 17 15:15:42 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sat Jun 17 15:37:29 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net/Index/SegmentCoreReaders.cs | 12 ++++++------
 src/Lucene.Net/Index/SegmentReader.cs      | 24 +++++++++++++-----------
 src/Lucene.Net/Search/FieldCacheImpl.cs    |  8 ++++----
 3 files changed, 23 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56025d33/src/Lucene.Net/Index/SegmentCoreReaders.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/SegmentCoreReaders.cs b/src/Lucene.Net/Index/SegmentCoreReaders.cs
index e9b03fb..c37aea7 100644
--- a/src/Lucene.Net/Index/SegmentCoreReaders.cs
+++ b/src/Lucene.Net/Index/SegmentCoreReaders.cs
@@ -30,7 +30,7 @@ namespace Lucene.Net.Index
     using Directory = Lucene.Net.Store.Directory;
     using DocValuesProducer = Lucene.Net.Codecs.DocValuesProducer;
     using FieldsProducer = Lucene.Net.Codecs.FieldsProducer;
-    using ICoreClosedListener = Lucene.Net.Index.SegmentReader.ICoreClosedListener;
+    using ICoreDisposedListener = Lucene.Net.Index.SegmentReader.ICoreDisposedListener;
     using IOContext = Lucene.Net.Store.IOContext;
     using IOUtils = Lucene.Net.Util.IOUtils;
     using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
@@ -115,7 +115,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        private readonly ISet<ICoreClosedListener> coreClosedListeners = new ConcurrentHashSet<ICoreClosedListener>(new
IdentityComparer<ICoreClosedListener>());
+        private readonly ISet<ICoreDisposedListener> coreClosedListeners = new ConcurrentHashSet<ICoreDisposedListener>(new
IdentityComparer<ICoreDisposedListener>());
 
         internal SegmentCoreReaders(SegmentReader owner, Directory dir, SegmentCommitInfo
si, IOContext context, int termsIndexDivisor)
         {
@@ -267,13 +267,13 @@ namespace Lucene.Net.Index
         {
             lock (coreClosedListeners)
             {
-                foreach (ICoreClosedListener listener in coreClosedListeners)
+                foreach (ICoreDisposedListener listener in coreClosedListeners)
                 {
                     // SegmentReader uses our instance as its
                     // coreCacheKey:
                     try
                     {
-                        listener.OnClose(this);
+                        listener.OnDispose(this);
                     }
                     catch (Exception t)
                     {
@@ -292,12 +292,12 @@ namespace Lucene.Net.Index
             }
         }
 
-        internal void AddCoreClosedListener(ICoreClosedListener listener)
+        internal void AddCoreDisposedListener(ICoreDisposedListener listener)
         {
             coreClosedListeners.Add(listener);
         }
 
-        internal void RemoveCoreClosedListener(ICoreClosedListener listener)
+        internal void RemoveCoreDisposedListener(ICoreDisposedListener listener)
         {
             coreClosedListeners.Remove(listener);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56025d33/src/Lucene.Net/Index/SegmentReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/SegmentReader.cs b/src/Lucene.Net/Index/SegmentReader.cs
index c5baf10..4af36b5 100644
--- a/src/Lucene.Net/Index/SegmentReader.cs
+++ b/src/Lucene.Net/Index/SegmentReader.cs
@@ -666,39 +666,41 @@ namespace Lucene.Net.Index
         /// <summary>
         /// Called when the shared core for this <see cref="SegmentReader"/>
         /// is disposed.
-        /// <para>
+        /// <para/>
         /// This listener is called only once all <see cref="SegmentReader"/>s
         /// sharing the same core are disposed.  At this point it
         /// is safe for apps to evict this reader from any caches
         /// keyed on <see cref="CoreCacheKey"/>.  This is the same
         /// interface that <see cref="Search.IFieldCache"/> uses, internally,
-        /// to evict entries.</para>
-        ///
+        /// to evict entries.
+        /// <para/>
+        /// NOTE: This was CoreClosedListener in Lucene.
+        /// <para/>
         /// @lucene.experimental
         /// </summary>
-        public interface ICoreClosedListener // LUCENENET TODO: API Rename ICoreDisposedListener
+        public interface ICoreDisposedListener 
         {
             /// <summary>
             /// Invoked when the shared core of the original 
             /// <see cref="SegmentReader"/> has disposed.
             /// </summary>
-            void OnClose(object ownerCoreCacheKey); // LUCENENET TODO: API Rename OnDispose()
+            void OnDispose(object ownerCoreCacheKey);
         }
 
         /// <summary>
-        /// Expert: adds a <see cref="ICoreClosedListener"/> to this reader's shared
core </summary>
-        public void AddCoreClosedListener(ICoreClosedListener listener)
+        /// Expert: adds a <see cref="ICoreDisposedListener"/> to this reader's shared
core </summary>
+        public void AddCoreDisposedListener(ICoreDisposedListener listener)
         {
             EnsureOpen();
-            core.AddCoreClosedListener(listener);
+            core.AddCoreDisposedListener(listener);
         }
 
         /// <summary>
-        /// Expert: removes a <see cref="ICoreClosedListener"/> from this reader's
shared core </summary>
-        public void RemoveCoreClosedListener(ICoreClosedListener listener)
+        /// Expert: removes a <see cref="ICoreDisposedListener"/> from this reader's
shared core </summary>
+        public void RemoveCoreDisposedListener(ICoreDisposedListener listener)
         {
             EnsureOpen();
-            core.RemoveCoreClosedListener(listener);
+            core.RemoveCoreDisposedListener(listener);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56025d33/src/Lucene.Net/Search/FieldCacheImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Search/FieldCacheImpl.cs b/src/Lucene.Net/Search/FieldCacheImpl.cs
index 30ca516..5cd00b8 100644
--- a/src/Lucene.Net/Search/FieldCacheImpl.cs
+++ b/src/Lucene.Net/Search/FieldCacheImpl.cs
@@ -139,12 +139,12 @@ namespace Lucene.Net.Search
         }
 
         // per-segment fieldcaches don't purge until the shared core closes.
-        internal readonly SegmentReader.ICoreClosedListener purgeCore;
+        internal readonly SegmentReader.ICoreDisposedListener purgeCore;
 
 #if FEATURE_SERIALIZABLE
         [Serializable]
 #endif
-        private class CoreClosedListenerAnonymousInnerClassHelper : SegmentReader.ICoreClosedListener
+        private class CoreClosedListenerAnonymousInnerClassHelper : SegmentReader.ICoreDisposedListener
         {
             private FieldCacheImpl outerInstance;
 
@@ -153,7 +153,7 @@ namespace Lucene.Net.Search
                 this.outerInstance = outerInstance;
             }
 
-            public void OnClose(object ownerCoreCacheKey)
+            public void OnDispose(object ownerCoreCacheKey)
             {
                 outerInstance.PurgeByCacheKey(ownerCoreCacheKey);
             }
@@ -185,7 +185,7 @@ namespace Lucene.Net.Search
         {
             if (reader is SegmentReader)
             {
-                ((SegmentReader)reader).AddCoreClosedListener(purgeCore);
+                ((SegmentReader)reader).AddCoreDisposedListener(purgeCore);
             }
             else
             {


Mime
View raw message