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: r1162336 - /incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Analyzer.cs
Date Sat, 27 Aug 2011 12:43:56 GMT
Author: digy
Date: Sat Aug 27 12:43:55 2011
New Revision: 1162336

URL: http://svn.apache.org/viewvc?rev=1162336&view=rev
Log:
[LUCENENET-358] MemoryLeaks
See
http://groups.google.com/group/ravendb/browse_thread/thread/9c6340987407aece/1d86d6a61175233c
and
http://mail-archives.apache.org/mod_mbox/lucene-lucene-net-user/201108.mbox/browser

Added IDisposable to Analyzer.cs


Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Analyzer.cs

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Analyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Analyzer.cs?rev=1162336&r1=1162335&r2=1162336&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Analyzer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Analyzer.cs Sat Aug
27 12:43:55 2011
@@ -41,7 +41,7 @@ namespace Lucene.Net.Analysis
     ///     </para>
     /// </remarks>
     // REFACTOR: determine if this class should use IDisposable since it has a Close() method.
-	public abstract class Analyzer
+	public abstract class Analyzer : IDisposable
 	{
         private CloseableThreadLocal<object> tokenStreams = new CloseableThreadLocal<object>();
 
@@ -249,8 +249,13 @@ namespace Lucene.Net.Analysis
         /// </remarks>
 		public virtual void  Close()
 		{
-			tokenStreams.Close();
+			if(tokenStreams!=null) tokenStreams.Close();
 			tokenStreams = null;
 		}
+
+        public virtual void Dispose()
+        {
+            Close();
+        }
 	}
 }
\ No newline at end of file



Mime
View raw message