Hi Ed,
I am storing it in the applicationMap only when the FacesContext is
available.
If not I am always going through the process of building up the map.
That way it can work also when someone decides to do something really
tricky.
On the note of making it available I think it would be prudent to not go
through
this until the first time this component actually is needed.
Manfred
On 9/13/2013 5:09 PM, Edward Burns wrote:
>>>>>> On Fri, 13 Sep 2013 12:09:42 -0500, Manfred Riem <manfred.riem_at_oracle.com> said:
> MR> Hi all,
> MR> Because of issue #2746 I propose an implementation change in UIComponentBase
> MR> that makes the static descriptors field a non-static field.
>
> MR> See the JIRA issue for the proposed implementation.
>
> MR> Let me know your thoughts!
>
> In populateDescriptorsMapIfNecessary() you are making the private
> descriptors map no longer static. Instead, you are storing it in the
> application scope. This is fine in and of itself, but wouldn't you need
> to do some sort of two-phase process to initially get access to the map
> in that method? Without such protection, your proposed solution seems
> open to race conditions.
>
> Because the map is now a ConcurrentHashMap, reads and writes to the map
> should be fine. I suggest pre-allocating the map in that place in our
> code where we do a bunch of stuff on the PostConstructApplicationEvent.
> I think it's in WebConfiguration. This eliminates the possibility of
> a race condition in the creation of the COMPONENT_DESCRIPTORS_MAP.
>
> Ed
>