You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2011/11/11 09:05:52 UTC
[Lucene.Net] svn commit: r1200758 -
/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SpellChecker/Spell/SpellChecker.cs
Author: digy
Date: Fri Nov 11 08:05:52 2011
New Revision: 1200758
URL: http://svn.apache.org/viewvc?rev=1200758&view=rev
Log:
[LUCENENET-443] "SpellChecker finaliser calls close regardless of if closed already"
for 2.9.4g
Modified:
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SpellChecker/Spell/SpellChecker.cs
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SpellChecker/Spell/SpellChecker.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SpellChecker/Spell/SpellChecker.cs?rev=1200758&r1=1200757&r2=1200758&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SpellChecker/Spell/SpellChecker.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SpellChecker/Spell/SpellChecker.cs Fri Nov 11 08:05:52 2011
@@ -57,7 +57,7 @@ namespace SpellChecker.Net.Search.Spell
/// </author>
/// <version> 1.0
/// </version>
- public class SpellChecker
+ public class SpellChecker : IDisposable
{
/// <summary> Field name for each word in the ngram index.</summary>
public const System.String F_WORD = "word";
@@ -540,6 +540,15 @@ namespace SpellChecker.Net.Search.Spell
}
}
+ public void Dispose()
+ {
+ lock (searcherLock)
+ {
+ if (!this.closed)
+ this.Close();
+ }
+ }
+
private void SwapSearcher(Directory dir)
{
/*
@@ -589,7 +598,7 @@ namespace SpellChecker.Net.Search.Spell
~SpellChecker()
{
- this.Close();
+ this.Dispose();
}
}
}
\ No newline at end of file