Bug 225314 - 4.2s - j2ee.deployment.impl.Server.getOptionalFactory()
4.2s - j2ee.deployment.impl.Server.getOptionalFactory()
Status: NEW
Product: serverplugins
Classification: Unclassified
Component: GlassFish
7.3
All All
: P3 (vote)
: 8.0
Assigned To: TomasKraus
issues@serverplugins
EXCEPTIONS_REPORT perf-profileme NB_ONLY
: PERFORMANCE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-25 04:35 UTC by Exceptions Reporter
Modified: 2013-12-06 17:51 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
nps snapshot (89.71 KB, application/nps)
2013-01-25 04:35 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2013-01-25 04:35:18 UTC
This bug was originally marked as duplicate of bug 174134, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.3 Beta (Build 201210011125)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_04-b12
OS: Windows Vista
Maximum slowness yet reported was 4230 ms, average is 4230
Comment 1 Exceptions Reporter 2013-01-25 04:35:22 UTC
Created attachment 130614 [details]
nps snapshot
Comment 2 Petr Hejl 2013-06-18 10:13:54 UTC
There are two things:
1) Maybe the GF should register optional factory via org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyOptionalFactory. I'm not sure about side effects such as race condition in initialization.
2) GlassfishInstance.hashCode() is touching the disk. Actually not just touching - it is copying stuff.
Comment 3 TomasKraus 2013-08-04 00:14:11 UTC
    public int hashCode() {
        StringBuilder sb = new StringBuilder(
                getDeployerUri().replace("127.0.0.1", "localhost"));
        sb.append(getHttpPort());
        sb.append(getDomainsRoot());
        sb.append(getDomainName());
        return sb.toString().hashCode();
    }

This looks quite safe when you look at it. But getDomainsRoot() can initialize new domains root when the one registered in GF is read only and it has to initialize whole GF domain.
So yes, this is bad. Displayname is 100% unique so maybe it's safe enough to use this String to generate hash. The only problem is, that those strings are usually very similar (their code distance is very low). String hash is being computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] so this seems to be safe - it usually differs at the end and looks like this method will guarantee some spread of those values.
I'll change it to String hash from display name.

I see GlassfishInstance.loadServerInstances as the most critical part of this snapshot. What will this optional factory registration do? We need to kick GlassfishInstanceProvider somehow and the best place is some asynchronous task far from AWT thread.

This is the same as Bug# 233869 - I added you into cc list - asynchronous access to GlassfishInstanceProvider before anythyng else touches it would help.
Comment 4 TomasKraus 2013-08-05 18:24:05 UTC
2) is fixed, checked int web-main:
----------------------------------
changeset:   260328:f17b5b02564a
summary:     #225314 - GlassfishInstance#hashCode() rewritten
             to use server display name which is mandatory and unique
Comment 5 Quality Engineering 2013-08-07 02:27:02 UTC
Integrated into 'main-silver', will be available in build *201308062300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f17b5b02564a
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #225314 - GlassfishInstance#hashCode() rewritten to use server display name which is mandatory and unique


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo