Thank you for spotting this! It's what I'd call a _very_ lazy init. :-)

I see two problems: The first is, of course, that
ClientInfo.userAgentTemplates is never initialized. The second is
that ClientInfo.userAgentTemplates is not volatile, but the double-checked
lazy initialization pattern only works on volatile fields. (There's a
correct application of this pattern in the same file, in getExpectations().)

I would expect FindBugs to catch this kind of problem.

It looks like this behavior has been in place since revision 5015 (June
2009).

--tim


On Thu, Sep 23, 2010 at 8:35 PM, Michael Terrington <
[email protected]> wrote:

> I noticed in a very multi-threaded application that lots of my threads
> were blocking in a call to ClientInfo.getUserAgentTemplates().  The
> method appears to be intended to lazy init
> ClientInfo.userAgentTemplates but I can't find anywhere that it
> actually sets the property.
>
> Regards,
> Michael.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2663853
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2663886

Reply via email to