[GLASSFISH-16204] Replace hardcoded 20 timeout for server startup in AdminAdapter with configurable value Created: 14/Mar/11  Updated: 22/May/13

Status: Open
Project: glassfish
Component/s: command_line_interface
Affects Version/s: 3.1
Fix Version/s: future release

Type: Improvement Priority: Major
Reporter: Tom Mueller Assignee: kumara
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


The AdminAdapter.service method contains the following code:

if (!latch.await(20L, TimeUnit.SECONDS)) {

This statement waits up to 20 seconds for the server to become ready before processing any asadmin command.
Depending on the number and type of applications that are deployed to the server, it may take more than 20 seconds for the server to start, and when starting the server and running commands from a script, it is desirable to be able to increase this value.

This RFE requests that the hardcoded "20L" be turned into a configurable parameter for the system either through an environment variable or a system property.

This problem was reported on the glassfish users mailing list on 3/14/2011.

Comment by Tom Mueller [ 05/Apr/11 ]

A fix for this issue was initially identified for possible inclusion in the 3.2 release, but after further 3.2 planning, the feature or improvement did not make the cut. This issue is being targeted for a future release. If based on a reevaluation, it is targeted for 3.2, then update the "fix version" again.

Comment by Kevin Dean [ 13/Feb/13 ]

This is highly aggravating; it just bit me as I was working on my deployment scripts. There is a workaround. The following snippet of Ant code waits for the JMX service to start on port 8686. As that's the last thing that GlassFish does on startup, it's a good way of checking the state of the server. Share and enjoy. And yes, please fix.

<echo message="Waiting for startup to complete..."/>

<!-- GlassFish has completed startup but hasn't loaded the applications; JMX service port is the last to open so watch for it. -->
<waitfor maxwait="600" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="startup_timeout">
<socket server="localhost" port="8686"/>

<isset property="startup_timeout"/>

<fail message="GlassFish startup timed out."/>

Generated at Thu Mar 05 20:14:04 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.