jbossas/jboss-as — pull request #3360 by BrentDouglas (2012-10-29 16:06:18+00:00)
Title: Cli connection timeout on first attempt

I have experienced an issue connecting to AS7 from the CLI where the first attempt at running the 'connect' command fails every time however always succeeds on a second attempt. I have experienced this issue running a standalone server (7.1.2.Final and a build from source) on a laptop running Fedora 17 w/ Oracle jdk7u9 and the same laptop running Fedora 16 w/ Oracle jdk7r4. Please let me know if more information about reproducing the issue is required.

When the first 'connect' command is issued there is a delay of ~6 seconds between sending the command and the first bytes getting written to the channel while the second call starts writing almost immediately. I made the following changes to allow me to work around the issue.

Currently, when ProtocolConnectionUtil#connectSync enters it's waiting loop, wrapperHandler has not always been called and may be dropped before the timeout expires. This has been amended to only drop the future after the timeout period has expired.

Secondly, the default timeout period of 5 seconds was still timing out so an optional CLI parameter has been added to set the timeout period. The default value remains as before.