lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Subject Re: svn commit: r1375282 - /incubator/lucene.net/trunk/src/core/Util/Parameter.cs
Date Mon, 20 Aug 2012 22:21:42 GMT
Instead of doing it this way, do NOT create Occur using separate static
fields.
Merge Parameter into Occur (only used there) and create the entire
dictionary once.
Otherwise, you run into risk of the ArgumentException.
If that happens, because this is raised from the static ctor, you'll have
killed the entire app domain.

On Tue, Aug 21, 2012 at 1:19 AM, Itamar Syn-Hershko <itamar@code972.com>wrote:

> This will probably require releasing the core again as well as a new RC...
>
> The spatial module was updated, still doing some integration tests, will
> send more updates soon
>
> On Tue, Aug 21, 2012 at 1:14 AM, <synhershko@apache.org> wrote:
>
> > Author: synhershko
> > Date: Mon Aug 20 22:14:01 2012
> > New Revision: 1375282
> >
> > URL: http://svn.apache.org/viewvc?rev=1375282&view=rev
> > Log:
> > Fixing a possible NRE which can be thrown during a race condition on
> > accessing allParameters
> >
> > This is not an air-tight solution, as an ArgumentException can still be
> > thrown. I don't care much about doing this within a lock as it will never
> > be a bottleneck.
> >
> >
> >
> https://groups.google.com/group/ravendb/browse_thread/thread/a5cf07e80f70c856
> >
> > Modified:
> >     incubator/lucene.net/trunk/src/core/Util/Parameter.cs
> >
> > Modified: incubator/lucene.net/trunk/src/core/Util/Parameter.cs
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Util/Parameter.cs?rev=1375282&r1=1375281&r2=1375282&view=diff
> >
> >
> ==============================================================================
> > --- incubator/lucene.net/trunk/src/core/Util/Parameter.cs (original)
> > +++ incubator/lucene.net/trunk/src/core/Util/Parameter.cs Mon Aug 20 22
> :14:01
> > 2012
> > @@ -39,11 +39,13 @@ namespace Lucene.Net.Util
> >                         // typesafe enum pattern, no public constructor
> >                         this.name = name;
> >                         string key = MakeKey(name);
> > -
> > -                       if (allParameters.ContainsKey(key))
> > -                               throw new
> > System.ArgumentException("Parameter name " + key + " already used!");
> > -
> > -                       allParameters[key] = this;
> > +
> > +                       lock (allParameters)
> > +                       {
> > +                               if (allParameters.ContainsKey(key))
> > +                                       throw new
> > System.ArgumentException("Parameter name " + key + " already used!");
> > +                               allParameters[key] = this;
> > +                       }
> >                 }
> >
> >                 private string MakeKey(string name)
> >
> >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message