users@glassfish.java.net

Re: Slow to instaniate an object in Glassfish

From: <glassfish_at_javadesktop.org>
Date: Tue, 27 May 2008 18:06:17 PDT

Is the class you are trying to instantiate bundled with your webapp, or is it defined higher up in the classloader delegation chain? Are you trying to create 1000 instance of the same class?

By default, GlassFish first delegates the loading of a class/resource to the webapp's parent classloader, before looking inside the webapp's own WEB-INF/classes and WEB-INF/lib/[*.jar].

You can change this behaviour by turning off delegation in your sun-web.xml, as follows:

<sun-web-app>
    <class-loader delegate="false"/>
</sun-web-app>

This may speed up the loading of any local classes that you are trying to instantiate.
[Message sent by forum member 'jluehe' (jluehe)]

http://forums.java.net/jive/thread.jspa?messageID=276911