Re: Deadlock issue

Daniel López <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi,

Could it be that for some reason the ScriptEngine object you are using 
to load the Groovy Scripts is being re-created? That would imply 
re-compiling the scripts and creating new versions of the equivalent 
classes, even though the resulting .class would be the same each time.

That would be odd, as you would have probably noticed by the huge drop 
in performance, but that would explain why the classes are being 
considered "new", so you might want to check it out to discard a bug in 
there.

S!
D.


El 20/04/2012 8:32, Jacopo Cappellato escribió:
>
> On Apr 19, 2012, at 11:28 PM, Daniel Dekany wrote:
>
>>> Yes they are the data preparation scripts for the templates and are
>>> all Groovy scripts; an example of an OFBiz screen declaration is the following:
>>>
>>>     <screen name="MicroCart">
>>>         <section>
>>>             <actions>
>>>                 <script
>>> location="component://somecomponent/webapp/somecomponent/WEB-INF/actions/ShoppingCartReadHelper.groovy"/>
>>>             </actions>
>>>             <widgets>
>>>                 <platform-specific><html><html-template
>>> location="component://somecomponent/webapp/somecomponent/cart/MicroCart.ftl"/></html></platform-specific>
>>>             </widgets>
>>>         </section>
>>>     </screen>
>>>
>>> And the same groovy scripts or ftl templates are reused by
>>> different screen definitions in different webapplications.
>>
>> Are these loaded from a common jar file (and I don't mean the copies
>> of the same jar, but a single file)? If they are, FreeMarker should
>> not face multiple versions of the same class, and you shouldn't have
>> this problem. (Unless there's something special in how Groovy scripts
>> are loaded...)
>>
>
> The screen definition, the Groovy script and the Freemarker template are unique in the classpath: we do not wrap them into a jar file but they are loaded by the OFbiz framework from the filesystem and cached in memory.
> I have added the following debug line to BeansWrapper.introspectClassInternal:
>
>              if(logger.isInfoEnabled())
>              {
>                  logger.info("Detected a reloaded class [" + className +
>                          "]. Clearing BeansWrapper caches.");
>                  logger.info("   Class [" + clazz + "], Class name [" + clazz.getName() + "], Classloader [" + clazz.getClassLoader() + "]."); // NEW DEBUG STATEMENT
>              }
>
> and I got the following output:
>
> 2012-04-20 08:21:12,504 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ] Detected a reloaded class [ShoppingCartReadHelper$_run_closure2]. Clearing BeansWrapper caches.
> 2012-04-20 08:21:12,504 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ]    Class [class ShoppingCartReadHelper$_run_closure2], Class name [ShoppingCartReadHelper$_run_closure2], Classloader [groovy.lang.GroovyClassLoader$InnerLoader@43d4db73].
> 2012-04-20 08:21:12,561 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ] Detected a reloaded class [ShoppingCartReadHelper$_run_closure1]. Clearing BeansWrapper caches.
> 2012-04-20 08:21:12,562 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ]    Class [class ShoppingCartReadHelper$_run_closure1], Class name [ShoppingCartReadHelper$_run_closure1], Classloader [groovy.lang.GroovyClassLoader$InnerLoader@43d4db73].
> 2012-04-20 08:21:26,407 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ] Detected a reloaded class [ShoppingCartReadHelper$_run_closure3]. Clearing BeansWrapper caches.
> 2012-04-20 08:21:26,408 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ]    Class [class ShoppingCartReadHelper$_run_closure3], Class name [ShoppingCartReadHelper$_run_closure3], Classloader [groovy.lang.GroovyClassLoader$InnerLoader@43d4db73].
> 2012-04-20 08:21:28,906 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ] Detected a reloaded class [ShoppingCartReadHelper$_run_closure1]. Clearing BeansWrapper caches.
> 2012-04-20 08:21:28,906 (http-0.0.0.0-8080-97) [ Log4JLoggerFactory.java:101:INFO ]    Class [class ShoppingCartReadHelper$_run_closure1], Class name [ShoppingCartReadHelper$_run_closure1], Classloader [groovy.lang.GroovyClassLoader$InnerLoader@43d4db73].
>
> Kind regards,
>
> Jacopo
>
>> --
>> 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!
http://p.sf.net/sfu/Boundary-d2dvs2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.