Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 225314 - 4.2s - j2ee.deployment.impl.Server.getOptionalFactory()
4.2s - j2ee.deployment.impl.Server.getOptionalFactory()
Product: serverplugins
Classification: Unclassified
Component: GlassFish
All All
: P3 (vote)
: 8.1
Assigned To: Petr Hejl
Depends on:
  Show dependency treegraph
Reported: 2013-01-25 04:35 UTC by Exceptions Reporter
Modified: 2015-05-18 15:30 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT

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

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 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("", "localhost"));
        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 (upload may still be in progress)

User: Tomas Kraus <>
Log: #225314 - GlassfishInstance#hashCode() rewritten to use server display name which is mandatory and unique
Comment 6 Petr Hejl 2015-05-18 15:30:35 UTC
#1 has been fixed recently in another issue.

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