On 1/29/15 3:07 AM, Daniel Fuchs wrote:
On 28/01/15 07:46, Mandy Chung wrote:
com/sun/management/internal/PlatformMBeanProviderImpl.java
    line 43: does this mxbeanList have to be created lazily?
    Would it be better to make it a final field and create it at the
constructor?

Hi Mandy,

I was the one to suggest the lazy initialization.
Given that the constructor is going to be invoked by the
ServiceLoader, I thought it would be better to delay any
heavy initialization until such time that the loaded
service provider is actually used.


These providers will need to be loaded and the mxbeanList will be looked at except for the cases that we are sure that the MXBean only comes from the default provider. I see the cost of constructing mxbeanList involves loading several classes. If performance is an issue, perhaps the fast-path would be in ManagementFactory to defer loading providers and may be better to follow up the performance side in the second phase (that I expect more changes to sun/management classes)

You may want to consider using limited doPrivileged (that can be done in the second phase).

Mandy

best regards,

-- daniel

Reply via email to