glassfish
  1. glassfish
  2. GLASSFISH-18284

Deployment/kernel cleanup - Phase 1: Introduce ArchiveDetector

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b21
    • Fix Version/s: 4.0
    • Component/s: deployment
    • Labels:
      None

      Description

      ArchiveHandlers which are consulted at the beginning of every deployment are also responsible for creation of class loaders, which is a very core functionality of a container. A good example of this is WarHandler which creates WebappClassLoader. So, we need to bring in a notion of archive detector to help us move ArchiveHandlers to container implementation modules to avoid early initialization of containers.

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        Introduced an abstraction called ArchiveDetector which just detects type of an archive.
        See its javadoc for further details.
        Implemented it for ear/ejbjar/rar/war/car types.
        Moved appclient version caclculation code from JarHandler to CarHandler.
        Moved ejb related code from JarHandler to EjbJarHandler.
        I don't believe we had all these code in JarHandler in nucleus.
        Renamed ConnectorHandler to RarHandler.
        ArchiveDetector/ArchiveHandler make a handle/body pair thus facilitating lazy loading of handlers.
        Since handlers, where most of the heavy lifting happens, can be moved out of connector modules,
        the connector modules can be thin. e.g., gf-web-connector no longer brings in war-util.

        Added ability in GenericSniffer to setup a list of modules(bundles) that are needed by a particular container.

        Tests run: QL, deployment devtests and EJB devtests.

        Next steps:
        1) Types cleanup: I would like to clean up "types." We have too many "types" in our code - some of them as pure Strings and others as Java classes.
        e.g., ModuleType, XModuleType, ArchiveHandler.getArchiveType(), Sniffer.getModuleType(), DeploymentUtils.isXXX().
        I am convinced that we just need two types: XModuleType and ContainerName.
        XModuleType is identical to j2ee ModuleType except that it's extensible and not tied to j2ee.
        As I have added comments in the new code, I will replace ArchiveType by XModuleType.
        ContainerName is what is used to identify a technology subsystem and used in Sniffers.
        I have looked at ExtensionArchivists and know how to fix them as well.
        I will most likely elevate XModuleType to glassfish-api with some changes in implementation
        so that I can get rid of use of Strings in interfaces like ArchiveHandler.getType().

        2) Optimize sniffer selection: We can exclude some sniffers for a particular technology type and
        preselect some sniffers for an archive to avoid paying the cost of discovering the same thing again and again.

        3) Move logic out of DeploymentUtils.isXXX to ArchiveDetectors.

        4) Some more when I have more time to describe.

        Revisions:
        ----------
        52355

        Modified Paths:
        ---------------
        trunk/main/nucleus/common/internal-api/src/main/java/org/glassfish/internal/deployment/GenericSniffer.java
        trunk/main/appserver/deployment/javaee-full/pom.xml
        trunk/main/appserver/deployment/javaee-full/src/main/java/org/glassfish/javaee/full/deployment/EarContainer.java
        trunk/main/appserver/deployment/javaee-full/src/main/java/org/glassfish/javaee/full/deployment/EarHandler.java
        trunk/main/appserver/web/gf-web-connector/src/main/java/org/glassfish/web/sniffer/WebSniffer.java
        trunk/main/appserver/web/gf-web-connector/pom.xml
        trunk/main/appserver/web/war-util/src/main/java/com/sun/enterprise/glassfish/web/WarHandler.java
        trunk/main/nucleus/deployment/common/src/main/java/com/sun/enterprise/deploy/jar/JarHandler.java
        trunk/main/appserver/web/web-glue/osgi.bundle
        trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ContainerStarter.java
        trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java
        trunk/main/appserver/appclient/server/connector/pom.xml
        trunk/main/appserver/extras/osgi-container/src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveHandler.java
        trunk/main/appserver/web/war-util/pom.xml

        Added Paths:
        ------------
        trunk/main/appserver/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/CarHandler.java
        trunk/main/appserver/connectors/connectors-connector/src/main/java/com/sun/enterprise/connectors/connector/module/RarHandler.java
        trunk/main/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/EjbJarHandler.java
        trunk/main/appserver/deployment/javaee-full/src/main/java/org/glassfish/javaee/full/deployment/EarDetector.java
        trunk/main/appserver/extras/osgi-container/src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveDetector.java
        trunk/main/appserver/connectors/connectors-connector/src/main/java/com/sun/enterprise/connectors/connector/module/RarDetector.java
        trunk/main/appserver/web/gf-web-connector/src/main/java/org/glassfish/web/sniffer/WarDetector.java
        trunk/main/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/deployment/archive/ArchiveDetector.java
        trunk/main/appserver/appclient/server/connector/src/main/java/org/glassfish/appclient/server/connector/CarDetector.java
        trunk/main/appserver/ejb/ejb-connector/src/main/java/org/glassfish/ejb/EjbJarDetector.java

        Show
        Sanjeeb Sahoo added a comment - Introduced an abstraction called ArchiveDetector which just detects type of an archive. See its javadoc for further details. Implemented it for ear/ejbjar/rar/war/car types. Moved appclient version caclculation code from JarHandler to CarHandler. Moved ejb related code from JarHandler to EjbJarHandler. I don't believe we had all these code in JarHandler in nucleus. Renamed ConnectorHandler to RarHandler. ArchiveDetector/ArchiveHandler make a handle/body pair thus facilitating lazy loading of handlers. Since handlers, where most of the heavy lifting happens, can be moved out of connector modules, the connector modules can be thin. e.g., gf-web-connector no longer brings in war-util. Added ability in GenericSniffer to setup a list of modules(bundles) that are needed by a particular container. Tests run: QL, deployment devtests and EJB devtests. Next steps: 1) Types cleanup: I would like to clean up "types." We have too many "types" in our code - some of them as pure Strings and others as Java classes. e.g., ModuleType, XModuleType, ArchiveHandler.getArchiveType(), Sniffer.getModuleType(), DeploymentUtils.isXXX(). I am convinced that we just need two types: XModuleType and ContainerName. XModuleType is identical to j2ee ModuleType except that it's extensible and not tied to j2ee. As I have added comments in the new code, I will replace ArchiveType by XModuleType. ContainerName is what is used to identify a technology subsystem and used in Sniffers. I have looked at ExtensionArchivists and know how to fix them as well. I will most likely elevate XModuleType to glassfish-api with some changes in implementation so that I can get rid of use of Strings in interfaces like ArchiveHandler.getType(). 2) Optimize sniffer selection: We can exclude some sniffers for a particular technology type and preselect some sniffers for an archive to avoid paying the cost of discovering the same thing again and again. 3) Move logic out of DeploymentUtils.isXXX to ArchiveDetectors. 4) Some more when I have more time to describe. Revisions: ---------- 52355 Modified Paths: --------------- trunk/main/nucleus/common/internal-api/src/main/java/org/glassfish/internal/deployment/GenericSniffer.java trunk/main/appserver/deployment/javaee-full/pom.xml trunk/main/appserver/deployment/javaee-full/src/main/java/org/glassfish/javaee/full/deployment/EarContainer.java trunk/main/appserver/deployment/javaee-full/src/main/java/org/glassfish/javaee/full/deployment/EarHandler.java trunk/main/appserver/web/gf-web-connector/src/main/java/org/glassfish/web/sniffer/WebSniffer.java trunk/main/appserver/web/gf-web-connector/pom.xml trunk/main/appserver/web/war-util/src/main/java/com/sun/enterprise/glassfish/web/WarHandler.java trunk/main/nucleus/deployment/common/src/main/java/com/sun/enterprise/deploy/jar/JarHandler.java trunk/main/appserver/web/web-glue/osgi.bundle trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ContainerStarter.java trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java trunk/main/appserver/appclient/server/connector/pom.xml trunk/main/appserver/extras/osgi-container/src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveHandler.java trunk/main/appserver/web/war-util/pom.xml Added Paths: ------------ trunk/main/appserver/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/CarHandler.java trunk/main/appserver/connectors/connectors-connector/src/main/java/com/sun/enterprise/connectors/connector/module/RarHandler.java trunk/main/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/EjbJarHandler.java trunk/main/appserver/deployment/javaee-full/src/main/java/org/glassfish/javaee/full/deployment/EarDetector.java trunk/main/appserver/extras/osgi-container/src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveDetector.java trunk/main/appserver/connectors/connectors-connector/src/main/java/com/sun/enterprise/connectors/connector/module/RarDetector.java trunk/main/appserver/web/gf-web-connector/src/main/java/org/glassfish/web/sniffer/WarDetector.java trunk/main/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/deployment/archive/ArchiveDetector.java trunk/main/appserver/appclient/server/connector/src/main/java/org/glassfish/appclient/server/connector/CarDetector.java trunk/main/appserver/ejb/ejb-connector/src/main/java/org/glassfish/ejb/EjbJarDetector.java
        Hide
        Sanjeeb Sahoo added a comment -

        Forgot to mention that I have had a lengthy discussion with Hong before committing these changes. Thanks, Hong.

        Show
        Sanjeeb Sahoo added a comment - Forgot to mention that I have had a lengthy discussion with Hong before committing these changes. Thanks, Hong.
        Hide
        Sanjeeb Sahoo added a comment -

        I also had to make the following change as part of this task:

        Log Message:
        ------------
        Fixing CTS failure seen with deployment of rars with no ra.xml - only annottaions.
        Since DeploymentUtils was using old name of Rarhandler, it was not able to detect annotations in rar files
        and failing to select ConnectorSniffer. Thaknfully
        there exists a CTS test which uses a rar with no ra.xml - only annotations.
        It is hard to believe that nucleus knows about names of services present in appserver - no wonder I didn't spot it when I refactored
        in my last checkin.

        Revisions:
        ----------
        52372

        Modified Paths:
        ---------------
        trunk/main/nucleus/deployment/common/src/main/java/org/glassfish/deployment/common/DeploymentUtils.java

        Show
        Sanjeeb Sahoo added a comment - I also had to make the following change as part of this task: Log Message: ------------ Fixing CTS failure seen with deployment of rars with no ra.xml - only annottaions. Since DeploymentUtils was using old name of Rarhandler, it was not able to detect annotations in rar files and failing to select ConnectorSniffer. Thaknfully there exists a CTS test which uses a rar with no ra.xml - only annotations. It is hard to believe that nucleus knows about names of services present in appserver - no wonder I didn't spot it when I refactored in my last checkin. Revisions: ---------- 52372 Modified Paths: --------------- trunk/main/nucleus/deployment/common/src/main/java/org/glassfish/deployment/common/DeploymentUtils.java

          People

          • Assignee:
            Sanjeeb Sahoo
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: