lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 18/29: Lucene.Net.Store.NativeFSLockFactory: Renamed local variables to conform with naming rules (closes #222)
Date Tue, 09 Jul 2019 21:29:34 GMT
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 c3e7ae30de1f23ec4198c817073096e302fc7a1b
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Tue Jul 9 16:29:08 2019 +0700

    Lucene.Net.Store.NativeFSLockFactory: Renamed local variables to conform with naming rules
(closes #222)
---
 src/Lucene.Net/Store/NativeFSLockFactory.cs | 32 ++++++++++++++---------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/Lucene.Net/Store/NativeFSLockFactory.cs b/src/Lucene.Net/Store/NativeFSLockFactory.cs
index 6b253b8..a99e178 100644
--- a/src/Lucene.Net/Store/NativeFSLockFactory.cs
+++ b/src/Lucene.Net/Store/NativeFSLockFactory.cs
@@ -90,8 +90,8 @@ namespace Lucene.Net.Store
 
 		// LUCENENET: NativeFSLocks in Java are infact singletons; this is how we mimick that to
track instances and make sure
 		// IW.Unlock and IW.IsLocked works correctly
-        private static readonly Dictionary<string, Lock> _locks = new Dictionary<string,
Lock>();
-		private static readonly object _locks_lockObj = new object();
+        private static readonly Dictionary<string, Lock> locks = new Dictionary<string,
Lock>();
+        private static readonly object locksSyncLock = new object();
 
 		/// <summary>
 		/// Given a lock name, return the full prefixed path of the actual lock file.
@@ -111,10 +111,10 @@ namespace Lucene.Net.Store
         {
             var path = GetCanonicalPathOfLockFile(lockName);
             Lock l;
-			lock (_locks_lockObj)
+			lock (locksSyncLock)
 			{
-				if (!_locks.TryGetValue(path, out l))
-					_locks.Add(path, l = NewLock(path));
+				if (!locks.TryGetValue(path, out l))
+					locks.Add(path, l = NewLock(path));
 			}
             return l;
         }
@@ -135,11 +135,11 @@ namespace Lucene.Net.Store
             Lock l;
 			// this is the reason why we can't use ConcurrentDictionary: we need the removal and disposal
of the lock to be atomic
 			// otherwise it may clash with MakeLock making a lock and ClearLock disposing of it in
another thread.
-			lock (_locks_lockObj)
+			lock (locksSyncLock)
 			{
-				if (_locks.TryGetValue(path, out l))
+				if (locks.TryGetValue(path, out l))
 				{
-					_locks.Remove(path);
+					locks.Remove(path);
 					l.Dispose();
 				}
 			}
@@ -169,7 +169,7 @@ namespace Lucene.Net.Store
         private FileStream channel;
         private readonly string path;
         private readonly DirectoryInfo lockDir;
-		private readonly object lockObject = new object(); // avoid lock(this)
+		private readonly object syncLock = new object(); // avoid lock(this)
 
         public NativeFSLock(NativeFSLockFactory outerInstance, DirectoryInfo lockDir, string
path)
         {
@@ -180,7 +180,7 @@ namespace Lucene.Net.Store
 
         public override bool Obtain()
         {
-            lock (lockObject)
+            lock (syncLock)
             {
                 FailureReason = null;
 
@@ -248,7 +248,7 @@ namespace Lucene.Net.Store
         {
             if (disposing)
             {
-                lock (lockObject)
+                lock (syncLock)
                 {
                     // whether or not we have created a file, we need to remove
                     // the lock instance from the dictionary that tracks them.
@@ -291,7 +291,7 @@ namespace Lucene.Net.Store
 
         public override bool IsLocked()
         {
-            lock (lockObject)
+            lock (syncLock)
             {
                 // The test for is isLocked is not directly possible with native file locks:
 
@@ -342,7 +342,7 @@ namespace Lucene.Net.Store
         private FileStream channel;
         private readonly string path;
         private readonly DirectoryInfo lockDir;
-		private readonly object lockObject = new object(); // avoid lock(this)
+		private readonly object syncLock = new object(); // avoid lock(this)
 
 		public SharingAwareNativeFSLock(NativeFSLockFactory outerInstance, DirectoryInfo lockDir,
string path)
         {
@@ -383,7 +383,7 @@ namespace Lucene.Net.Store
 
         public override bool Obtain()
         {
-            lock (lockObject)
+            lock (syncLock)
             {
                 FailureReason = null;
 
@@ -468,7 +468,7 @@ namespace Lucene.Net.Store
         {
             if (disposing)
             {
-                lock (lockObject)
+                lock (syncLock)
                 {
                     // whether or not we have created a file, we need to remove
                     // the lock instance from the dictionary that tracks them.
@@ -506,7 +506,7 @@ namespace Lucene.Net.Store
 
         public override bool IsLocked()
         {
-            lock (lockObject)
+            lock (syncLock)
             {
                 // First a shortcut, if a lock reference in this instance is available
                 if (channel != null)


Mime
View raw message