[ 
https://issues.apache.org/jira/browse/OPENJPA-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12475507
 ] 

Craig Russell commented on OPENJPA-160:
---------------------------------------

>We ran some more performance tests with the latest OpenJPA code and the issue 
>appears to be with creating an instance of the BrokerImpl (when Configurations 
>calls Class.newInstance). 

I'm surprised that the time is being taken in the constructor.  The BrokerImpl 
is actually initialized for real during the initialize method, not the 
constructor, and that's where I'd expect to find the initialization cost.

There is no constructor implemented for BrokerImpl, so the only initialization 
done during the compiler-generated constructor is the initialization of the 
fields. Most of the fields are initialized to null, which takes no time (the 
initial memory allocated is cleared via a system clear memory call). The only 
things I see in the field initialization during newInstance are:
    private final JCAHelper _jca = new JCAHelper();
This is a stateless instance for which the constructor should be "free".

    private ClassLoader _loader = Thread.currentThread().
        getContextClassLoader();
Ah, perhaps this is the culprit?


> Reuse BrokerImpl objects
> ------------------------
>
>                 Key: OPENJPA-160
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-160
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Michael Dick
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to