just checked impl (in java7) and it sounds fine for me, thanks David!

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/5/12 David Blevins <[email protected]>

> We should be good.  UnmodifiableSet + iterator are just a wrappers and
> HashSet is thread-safe for read-only usage.  They're now populated in the
> constructor as local variables, so outside the constructor no one has a
> reference to them.
>
> If we revert back to the code where the hashsets are exposed, then we
> should probably use a CopyOnWriteArraySet as you suggest.
>
>
> -David
>
> On May 12, 2013, at 11:36 AM, Romain Manni-Bucau <[email protected]>
> wrote:
>
> > If you guarantee me unmodifiableSet itertors are thread safe i'm happy
> > otherwise please use a copyonwriteset then it'll not say anything more
> > Le 12 mai 2013 20:15, "David Blevins" <[email protected]> a écrit
> :
> >
> >> Looked into that this morning.
> >>
> >> It occurred to me that would definitely make it thread-safe, but alone
> >> doesn't give us the right logic for AnnotatedType.getMethods(), etc.
> which
> >> are supposed to return a complete list not a list being updated.  So
> we'd
> >> still need to block getMethods() calls until initialization is complete.
> >>
> >> Updated the code again.  Have a look and let me know if you see any more
> >> holes :)  The lists not being thread safe was definitely accurate.
> >>
> >>
> >> -David
> >>
> >> On May 11, 2013, at 11:49 PM, Romain Manni-Bucau <[email protected]
> >
> >> wrote:
> >>
> >>> I keep my comment/explanation on it, if you want it thread safe at
> >> runtime
> >>> convert it to sthg thread safe...copyonwriteXXX structures will be
> >> enough.
> >>> We dont need what you did IMO
> >>> Le 12 mai 2013 00:04, "David Blevins" <[email protected]> a
> écrit
> >> :
> >>>
> >>>>
> >>>> On May 11, 2013, at 1:59 PM, David Blevins <[email protected]>
> >>>> wrote:
> >>>>
> >>>>> That being said, I'll see if I can reduce the memory requirement of
> the
> >>>> fix.
> >>>>
> >>>> Done.  Managed to reduce the memory requirement of the original code
> for
> >>>> the lazy case as well.  Basically two object references lighter (128
> >> bits).
> >>>>
> >>>> Thread-safe, lighter and slightly more immutable.
> >>>>
> >>>>
> >>>> -David
> >>>>
> >>>>
> >>
> >>
>
>

Reply via email to