Vincent Massol wrote:
> Hi,
> 
> I think we might need to review our singleton components (i.e. all of  
> them ;)) for sync. issues.
> 
> For example take DefaultObservationManager:
> 
>      private Map<String, List<RegisteredListener>> listeners = new  
> HashMap<String, List<RegisteredListener>>();
> 
> It has for ex a addListener() method.
> 
> Imagine several threads all calling addListener().
> 
> Since HashMap is not synchronized this can cause problems.
> 
> Thus shared objects should all be synchronized or they should only be  
> filled once (as in an initialize method for ex).
> 
> WDYT? Do you agree there's a potential bug in the case above?

+1

> 
> Thanks
> -Vincent
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to