glassfish
  1. glassfish
  2. GLASSFISH-17643

nucleus main process is called "ASMain" in glassfish.jar

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: other
    • Labels:
      None

      Description

      The class that contains the main method for nucleus is called "ASMain". It is contained in a JAR file called "glassfish.jar" When nucleus is used for other Java servers, these may not be appropriate names. The class name is visible to the user in the following cases:

      • in "jps" output
      • in the "jconsole" opening screen (here the whole package is visible: com.sun.enterprise.glassfish.bootstrap.ASMain

      Possible solutions:

      1. Leave this as it is.

      2. Rename the class to something more generic. "Main" is probably too generic because other Java programs, most specifically, NetBeans, uses Main. "GFMain" might be appropriate since the Java package name contains "glassfish".

      3. Rename the class to be something specific to nucleus, such as NucleusMain. Rename the JAR file to nucleus.jar. Expect that nucleus-derived products provide their own JAR file that contains main, i.e., a class that extends NucleusMain. This would also require modifying the launcher so that it could identify the right JAR file to launch when starting the server.

      Related to this issue is other meta data that is associated with the main program. For example, the jvisualvm program displays the GlassFish logo and "GlassFish" next to the name of the process. This is based on the full class name showing up in the following file in jvisualvm: visualvm/application/src/com/sun/tools/visualvm/application/type/MainClassApplicationTypeFactory.java. If the name of the class is changed, then jvisualvm must be updated too.

        Activity

        Tom Mueller created issue -
        Hide
        Tom Mueller added a comment -

        A suggested fix from Bill Shannon:
        I would consider changing it so that glassfish.jar just has a main class
        and a class path entry entry referring to nucleus.jar.

        Show
        Tom Mueller added a comment - A suggested fix from Bill Shannon: I would consider changing it so that glassfish.jar just has a main class and a class path entry entry referring to nucleus.jar.
        Tom Mueller made changes -
        Field Original Value New Value
        Summary nucleus main process is called "ASMain" nucleus main process is called "ASMain" in glassfish.jar
        Description The class that contains the main method for nucleus is called "ASMain". When nucleus is used for other Java servers, this may not be an appropriate name. This name is visible to the user in the following cases:

        - in "jps" output
        - in the "jconsole" opening screen (here the whole package is visible: com.sun.enterprise.glassfish.bootstrap.ASMain

        Possible solutions:

        1. Leave this as it is.

        2. Rename the class to something more generic. "Main" is probably too generic because other Java programs, most specifically, NetBeans, uses Main. "GFMain" might be appropriate since the Java package name contains "glassfish".

        Related to this issue is other meta data that is associated with the main program. For example, the jvisualvm program displays the GlassFish logo and "GlassFish" next to the name of the process. This is based on the full class name showing up in the following file in jvisualvm: visualvm/application/src/com/sun/tools/visualvm/application/type/MainClassApplicationTypeFactory.java. If the name of the class is changed, then jvisualvm must be updated too.
        The class that contains the main method for nucleus is called "ASMain". It is contained in a JAR file called "glassfish.jar" When nucleus is used for other Java servers, these may not be appropriate names. The class name is visible to the user in the following cases:

        - in "jps" output
        - in the "jconsole" opening screen (here the whole package is visible: com.sun.enterprise.glassfish.bootstrap.ASMain

        Possible solutions:

        1. Leave this as it is.

        2. Rename the class to something more generic. "Main" is probably too generic because other Java programs, most specifically, NetBeans, uses Main. "GFMain" might be appropriate since the Java package name contains "glassfish".

        3. Rename the class to be something specific to nucleus, such as NucleusMain. Rename the JAR file to nucleus.jar. Expect that nucleus-derived products provide their own JAR file that contains main, i.e., a class that extends NucleusMain. This would also require modifying the launcher so that it could identify the right JAR file to launch when starting the server.

        Related to this issue is other meta data that is associated with the main program. For example, the jvisualvm program displays the GlassFish logo and "GlassFish" next to the name of the process. This is based on the full class name showing up in the following file in jvisualvm: visualvm/application/src/com/sun/tools/visualvm/application/type/MainClassApplicationTypeFactory.java. If the name of the class is changed, then jvisualvm must be updated too.
        Tom Mueller made changes -
        Assignee dochez [ dochez ] Tom Mueller [ tmueller ]
        Hide
        Bill Shannon added a comment -

        To expand on the previous comment...

        My suggestion was to put the nucleus content in a nucleus.jar with a main
        class named Main.

        (You could call it NucleusMain if you really wanted to, but almost no one will
        be running the Nucleus alone.)

        Put the app server content in a glassfish.jar with a main class named ASMain
        that subclasses Main. Add a Main-Class attribute referring to ASMain. Add a
        Class-Path attribute referring to nucleus.jar.

        Other servers built on nucleus should do something similar.

        Show
        Bill Shannon added a comment - To expand on the previous comment... My suggestion was to put the nucleus content in a nucleus.jar with a main class named Main. (You could call it NucleusMain if you really wanted to, but almost no one will be running the Nucleus alone.) Put the app server content in a glassfish.jar with a main class named ASMain that subclasses Main. Add a Main-Class attribute referring to ASMain. Add a Class-Path attribute referring to nucleus.jar. Other servers built on nucleus should do something similar.
        Tom Mueller made changes -
        Fix Version/s 4.0 [ 10970 ]
        Hide
        Tom Mueller added a comment -

        To implement the design idea in the previous comment, it would be necessary to change the start-domain and start-local-instance logic so that it would run the correct JAR file.

        Currently, the GFDomainLauncher and GFInstanceLauncher classes have the "glassfish.jar" and the full classname of ASMain hardcoded. If glassfish.jar is defined by appserver (not nucleus), then there should be no references to glassfish.jar anywhere within the nucleus code. Same with the "ASMain" class.

        The only other reference to the ASMain class in nucleus is in the bootstrap ReJar.java file.

        It should be possible to do this refactoring - just noting it here so as to not miss this.

        Show
        Tom Mueller added a comment - To implement the design idea in the previous comment, it would be necessary to change the start-domain and start-local-instance logic so that it would run the correct JAR file. Currently, the GFDomainLauncher and GFInstanceLauncher classes have the "glassfish.jar" and the full classname of ASMain hardcoded. If glassfish.jar is defined by appserver (not nucleus), then there should be no references to glassfish.jar anywhere within the nucleus code. Same with the "ASMain" class. The only other reference to the ASMain class in nucleus is in the bootstrap ReJar.java file. It should be possible to do this refactoring - just noting it here so as to not miss this.
        Tom Mueller made changes -
        Tags nucleus-cleanup 3_1_x-exclude 3_1_x-exclude 4_0-release-notes nucleus-cleanup
        Tom Mueller made changes -
        Tags 3_1_x-exclude 4_0-release-notes nucleus-cleanup 3_1_x-exclude nucleus-cleanup
        Hide
        Tom Mueller added a comment -

        Deferring to 4.0.1.

        Show
        Tom Mueller added a comment - Deferring to 4.0.1.
        Tom Mueller made changes -
        Fix Version/s 4.0.1 [ 16061 ]
        Fix Version/s 4.0 [ 10970 ]
        Tom Mueller made changes -
        Assignee Tom Mueller [ tmueller ] martin.mares [ martin.mares ]
        Romain Grécourt made changes -
        Fix Version/s 4.1 [ 16387 ]
        Fix Version/s 4.0.1 [ 16061 ]

          People

          • Assignee:
            martin.mares
            Reporter:
            Tom Mueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: