Java Mailing List Archive

Home » FreeMarker-user »

Re: [FreeMarker-user] Deadlock issue

Jacopo Cappellato


Replies: Find Java Web Hosting

Author LoginPost Reply

On Apr 20, 2012, at 6:23 PM, Daniel Dekany wrote:

> Friday, April 20, 2012, 2:33:44 PM, Jacopo Cappellato wrote:
>> Hi Daniel,
>> On Apr 20, 2012, at 2:21 PM, Daniel Dekany wrote:
>>> Friday, April 20, 2012, 10:37:52 AM, Jacopo Cappellato wrote:
>>>> Daniel D., Daniel L.,
>>>> thanks to both of you for the valuable help.
>>>> I was able to find and fix the OFBiz code that was causing the
>>>> multiple reload of Groovy related classes: in OFBiz there was cache
>>>> object containing the parsed Groovy scripts that was not managed in
>>>> a thread safe way.
>>> So then can it still occur that a Groovy-script-class is reloaded even
>>> if the script wasn't modified, only not so often?
>> It should no more happen now: the OFBiz cache object is now
>> properly synchronized and even if multiple threads will try to
>> compile the same script only the first Groovy-script-class will be
>> added to the cache and then used to renderthe freemarker template.
>> After this change all "reload" messages from freemarker disappeared.
> What I meant is that if these are in-memory-only classes, the Groovy
> script cache might drops some of them sometimes. If it's that kind of
> cache.

Oh yes, when you clear the cache in OFBiz then Freemarker will reload its caches; however, with the fix I did in OFBiz, Freemarker will now reload the cache only once while before it could reload it several times (we had a bug in OFBiz that prevented properly handling of concurrency and the same class was compiled and added to the cache several times).

We are testing now the fixes in production and they seem to have solved the problem, so thank you!

As a side note: I would like to propose/submit some patches to improve the implementation of synchronized code in BeansWrapper and so I am wondering if it would make sense to sign the CLA; I am an active committer (and I am in the OFBiz PMC) of OFBiz and we are using Freemarker extensively so it could be useful also in the future (if we will ever find a bug). In the same time I don't want to put on your shoulders unnecessary paperwork, so please disregard my proposal if you feel that a CLA is an overkill.

Kind regards,


> --
> Best regards,
> Daniel Dekany

For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
FreeMarker-user mailing list
©2008 - Jax Systems, LLC, U.S.A.