[arquillian-issues] [JBoss JIRA] (ARQ-322) Implement a GlassFish 3.1 managed container adapter

Dan Allen (JIRA) jira-events at lists.jboss.org
Mon Mar 12 00:13:47 EDT 2012


    [ https://issues.jboss.org/browse/ARQ-322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675795#comment-12675795 ] 

Dan Allen commented on ARQ-322:
-------------------------------

In follow-up to your other commands:

----

*deploying glassfish-resources.xml*

I agree that ideally we should wait on the fix in GlassFish. If that stalls, I think we could probably hit most of the use cases by parsing the XML file ourselves and issuing the individual delete-* commands in reverse. Let's open a separate tracking issue for that.

*setting the debug port*

I also agree that the start-domain command should accept a debug port. I did, however, look into what it would take to change the port in the container adapter.

In a nutshell, you can only change the debug port when the DAS is running (or you have to edit the domain.xml file manually). Here's the command:

{code}
asadmin set server.java-config.debug-options=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009
{code}

There is another issue at hand here. In order for the developer to make use of debugging w/ the managed container, it must be possible to set the suspend flag on the jdwp option. So --debug alone isn't sufficient (again, probably something start-domain should support).

Here's the code that would be required to do this today:

{code:title=GlassFishServerControl#start()}
if (config.isDebug()) {
    result = executeAdminCommand("Setting debug options", "set",
        Arrays.asList(config.getTarget() + ".java-config.debug-options=" +
            "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" +
            config.getDebugSocketPort()));
    if (result > 0) {
        executeAdminDomainCommand("Stopping container", "stop-domain", new ArrayList<String>());
        throw new LifecycleException("Could not set debug options");
    }
    
    // NOTE we can't use restart-domain with suspend=y because connecting the debugger
    //      does not resume startup
    result = executeAdminDomainCommand("Stopping container", "stop-domain", new ArrayList<String>());
    if (result > 0) {
        throw new LifecycleException("Could not stop container to restart in debug mode");
    }
    result = executeAdminDomainCommand("Starting container in debug mode", "start-domain",
        Arrays.asList("--debug"));
    if (result > 0) {
        throw new LifecycleException("Could not restart container in debug mode");
    }
}
{code}

{code:title=GlassFishServerControl#stop()}
if (config.isDebug()) {
    result = executeAdminCommand("Restoring debug options", "set",
        Arrays.asList(config.getTarget() + ".java-config.debug-options=" +
            "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" +
            config.getDebugSocketPort()));
    if (result > 0) {
        logger.warning("Could not reset debug options, you may need to change them manually");
    }
}
{code}

and of course the configuration property:

{code:title=GlassFishManagedContainerConfiguration}
/**
 * Socket port to use for debugging
 */
private int debugSocketPort = 9009;

public int getDebugSocketPort() {
    return debugSocketPort;
}

public void setDebugSocketPort(int debugSocketPort) {
    this.debugSocketPort = debugSocketPort;
}
{code}

*add support for JVM flags*

If setting the debug port wasn't complex enough, the JVM arguments are just crazy. Again, JVM options can be set with the DAS is running. However, it only supports deleting or appending, not replacing. To do this reliably, you have to read in the JVM options, figure out if the ones you want to add overlap, etc, etc.

Here's the asadmin command set to set an option:

{code}
asadmin --echo create-jvm-options -Xmx512m
{code}

This is really where I think manually editing the domain.xml would make sense, because working with the available commands is like having your hands tied.

----

There is one other option to all of this. We could support creating a domain configuration to set custom properties such as the debug port and jvm options, then restart into that configuration. The configuration is created using the copy-config command [1]. The benefit to this approach is that it would also side step the issue of having to revert any changes we make for the test run (such as the debug port).

[1] http://docs.oracle.com/cd/E18930_01/html/821-2433/copy-config-1.html#scrolltoc

                
> Implement a GlassFish 3.1 managed container adapter
> ---------------------------------------------------
>
>                 Key: ARQ-322
>                 URL: https://issues.jboss.org/browse/ARQ-322
>             Project: Arquillian
>          Issue Type: Feature Request
>          Components: GlassFish Containers
>    Affects Versions: glassfish_1.0.0.CR2
>            Reporter: Dan Allen
>            Assignee: Vineet Reynolds
>
> To round out the GlassFish support, we need a managed container adapter (see the JBoss AS managed container).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list