lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [18/20] lucenenet git commit: SWEEP: Corrected accessibility of Dispose(bool) for proper dispose pattern
Date Sun, 02 Apr 2017 07:06:18 GMT
SWEEP: Corrected accessibility of Dispose(bool) for proper dispose pattern


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

Branch: refs/heads/api-work
Commit: 02b78dd44c30838a4aac273d3c0a2398188945ba
Parents: b15f45d
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Apr 2 11:55:02 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Apr 2 11:58:37 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Store/CompoundFileDirectory.cs           | 2 +-
 src/Lucene.Net.Core/Store/Directory.cs                       | 5 +++--
 src/Lucene.Net.Core/Store/Lock.cs                            | 3 ++-
 src/Lucene.Net.Core/Store/MMapDirectory.cs                   | 7 +++++--
 src/Lucene.Net.Core/Store/NIOFSDirectory.cs                  | 2 +-
 src/Lucene.Net.Core/Store/NativeFSLockFactory.cs             | 2 +-
 src/Lucene.Net.Core/Store/NoLockFactory.cs                   | 2 +-
 src/Lucene.Net.Core/Store/SimpleFSDirectory.cs               | 2 +-
 src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs             | 2 +-
 src/Lucene.Net.Core/Store/SingleInstanceLockFactory.cs       | 2 +-
 src/Lucene.Net.Core/Store/VerifyingLockFactory.cs            | 2 +-
 src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs   | 2 +-
 src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs | 2 +-
 src/Lucene.Net.Tests/Store/TestLock.cs                       | 2 +-
 src/Lucene.Net.Tests/Store/TestLockFactory.cs                | 2 +-
 15 files changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs b/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
index 7b95e8d..8527b28 100644
--- a/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
+++ b/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
@@ -448,7 +448,7 @@ namespace Lucene.Net.Store
                 this.entry = entry;
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/Directory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/Directory.cs b/src/Lucene.Net.Core/Store/Directory.cs
index 80827d8..17cb98b 100644
--- a/src/Lucene.Net.Core/Store/Directory.cs
+++ b/src/Lucene.Net.Core/Store/Directory.cs
@@ -278,7 +278,7 @@ namespace Lucene.Net.Store
                 return new SlicedIndexInput("SlicedIndexInput(" + sliceDescription + " in
" + @base + ")", @base, offset, length);
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 if (disposing)
                 {
@@ -329,11 +329,12 @@ namespace Lucene.Net.Store
             [Obsolete("Only for reading CFS files from 3.x indexes.")]
             public abstract IndexInput OpenFullSlice(); // can we remove this somehow?
 
-            public abstract void Dispose(bool disposing);
+            protected abstract void Dispose(bool disposing);
 
             public void Dispose()
             {
                 Dispose(true);
+                GC.SuppressFinalize(this);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/Lock.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/Lock.cs b/src/Lucene.Net.Core/Store/Lock.cs
index c3c66f8..f09aee9 100644
--- a/src/Lucene.Net.Core/Store/Lock.cs
+++ b/src/Lucene.Net.Core/Store/Lock.cs
@@ -158,11 +158,12 @@ namespace Lucene.Net.Store
         public void Dispose()
         {
             Dispose(true);
+            GC.SuppressFinalize(this);
         }
 
         /// <summary>
         /// Releases exclusive access. </summary>
-        public abstract void Dispose(bool disposing);
+        protected abstract void Dispose(bool disposing);
 
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/MMapDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/MMapDirectory.cs b/src/Lucene.Net.Core/Store/MMapDirectory.cs
index 37296e6..dcba346 100644
--- a/src/Lucene.Net.Core/Store/MMapDirectory.cs
+++ b/src/Lucene.Net.Core/Store/MMapDirectory.cs
@@ -219,9 +219,12 @@ namespace Lucene.Net.Store
                 return (IndexInput)full.Clone();
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
-                full.Dispose();
+                if (disposing)
+                {
+                    full.Dispose();
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
index 6cc9aba..d1f268b 100644
--- a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs
@@ -109,7 +109,7 @@ namespace Lucene.Net.Store
                 this.descriptor = descriptor;
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 if (disposing)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/NativeFSLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NativeFSLockFactory.cs b/src/Lucene.Net.Core/Store/NativeFSLockFactory.cs
index d0aed22..47e6f15 100644
--- a/src/Lucene.Net.Core/Store/NativeFSLockFactory.cs
+++ b/src/Lucene.Net.Core/Store/NativeFSLockFactory.cs
@@ -183,7 +183,7 @@ namespace Lucene.Net.Store
             }
         }
 
-        public override void Dispose(bool disposing)
+        protected override void Dispose(bool disposing)
         {
             if (disposing)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/NoLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NoLockFactory.cs b/src/Lucene.Net.Core/Store/NoLockFactory.cs
index 985d9a4..5159ddd 100644
--- a/src/Lucene.Net.Core/Store/NoLockFactory.cs
+++ b/src/Lucene.Net.Core/Store/NoLockFactory.cs
@@ -63,7 +63,7 @@ namespace Lucene.Net.Store
             return true;
         }
 
-        public override void Dispose(bool disposing)
+        protected override void Dispose(bool disposing)
         {
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs b/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
index 8bc927b..ce76a84 100644
--- a/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
@@ -85,7 +85,7 @@ namespace Lucene.Net.Store
                 this.descriptor = descriptor;
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 if (disposing)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs b/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
index a457ed2..92588e4 100644
--- a/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
+++ b/src/Lucene.Net.Core/Store/SimpleFSLockFactory.cs
@@ -159,7 +159,7 @@ namespace Lucene.Net.Store
             }
         }
 
-        public override void Dispose(bool disposing)
+        protected override void Dispose(bool disposing)
         {
             if (disposing)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/SingleInstanceLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/SingleInstanceLockFactory.cs b/src/Lucene.Net.Core/Store/SingleInstanceLockFactory.cs
index 2c7babb..a5ee42f 100644
--- a/src/Lucene.Net.Core/Store/SingleInstanceLockFactory.cs
+++ b/src/Lucene.Net.Core/Store/SingleInstanceLockFactory.cs
@@ -75,7 +75,7 @@ namespace Lucene.Net.Store
             }
         }
 
-        public override void Dispose(bool disposing)
+        protected override void Dispose(bool disposing)
         {
             if (disposing)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Core/Store/VerifyingLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/VerifyingLockFactory.cs b/src/Lucene.Net.Core/Store/VerifyingLockFactory.cs
index d6c835b..731283f 100644
--- a/src/Lucene.Net.Core/Store/VerifyingLockFactory.cs
+++ b/src/Lucene.Net.Core/Store/VerifyingLockFactory.cs
@@ -86,7 +86,7 @@ namespace Lucene.Net.Store
                 }
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 if (disposing)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index 90dab4f..cfcce58 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -1354,7 +1354,7 @@ namespace Lucene.Net.Store
 
             private int disposed = 0;
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 if (0 == Interlocked.CompareExchange(ref this.disposed, 1, 0))
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs
index a1f35d3..4a8fd87 100644
--- a/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Store
                 }
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 if (disposing)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Tests/Store/TestLock.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestLock.cs b/src/Lucene.Net.Tests/Store/TestLock.cs
index 6d91581..2941dbd 100644
--- a/src/Lucene.Net.Tests/Store/TestLock.cs
+++ b/src/Lucene.Net.Tests/Store/TestLock.cs
@@ -61,7 +61,7 @@ namespace Lucene.Net.Store
                 return false;
             }
 
-            public override void Dispose(bool disposing)
+            protected override void Dispose(bool disposing)
             {
                 // do nothing
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02b78dd4/src/Lucene.Net.Tests/Store/TestLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
index 47991c9..8964277 100644
--- a/src/Lucene.Net.Tests/Store/TestLockFactory.cs
+++ b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
@@ -485,7 +485,7 @@ namespace Lucene.Net.Store
                     return true;
                 }
 
-                public override void Dispose(bool disposing)
+                protected override void Dispose(bool disposing)
                 {
                     // do nothing
                 }


Mime
View raw message