lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [Lucene.Net] svn commit: r1086015 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net/Index: FieldInfos.cs SegmentReader.cs
Date Sun, 27 Mar 2011 20:11:10 GMT
Author: digy
Date: Sun Mar 27 20:11:10 2011
New Revision: 1086015

URL: http://svn.apache.org/viewvc?rev=1086015&view=rev
Log:
[LUCENENET-399] Some lost "synchronized"s. TestIndexWriterReader.TestDuringAddIndexes still
fails. 

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FieldInfos.cs?rev=1086015&r1=1086014&r2=1086015&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs Sun Mar 27 20:11:10 2011
@@ -115,15 +115,18 @@ namespace Lucene.Net.Index
 		/// <summary> Returns a deep clone of this FieldInfos instance.</summary>
 		public System.Object Clone()
 		{
-			FieldInfos fis = new FieldInfos();
-			int numField = byNumber.Count;
-			for (int i = 0; i < numField; i++)
-			{
-				FieldInfo fi = (FieldInfo) ((FieldInfo) byNumber[i]).Clone();
-				fis.byNumber.Add(fi);
-				fis.byName[fi.name] = fi;
-			}
-			return fis;
+            lock (this)
+            {
+                FieldInfos fis = new FieldInfos();
+                int numField = byNumber.Count;
+                for (int i = 0; i < numField; i++)
+                {
+                    FieldInfo fi = (FieldInfo)((FieldInfo)byNumber[i]).Clone();
+                    fis.byNumber.Add(fi);
+                    fis.byName[fi.name] = fi;
+                }
+                return fis;
+            }
 		}
 		
 		/// <summary>Adds field info for a Document. </summary>

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/SegmentReader.cs?rev=1086015&r1=1086014&r2=1086015&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs Sun Mar 27 20:11:10
2011
@@ -911,14 +911,17 @@ namespace Lucene.Net.Index
 		
 		public override System.Object Clone()
 		{
-			try
-			{
-				return Clone(readOnly); // Preserve current readOnly
-			}
-			catch (System.Exception ex)
-			{
-				throw new System.SystemException(ex.Message, ex);
-			}
+            lock (this)
+            {
+                try
+                {
+                    return Clone(readOnly); // Preserve current readOnly
+                }
+                catch (System.Exception ex)
+                {
+                    throw new System.SystemException(ex.Message, ex);
+                }
+            }
 		}
 		
 		public override IndexReader Clone(bool openReadOnly)



Mime
View raw message