users@glassfish.java.net

Re: asadmin changes in v2.1 effect return status of some commands?

From: Alex Sherwin <alex.sherwin_at_acadiasoft.com>
Date: Tue, 27 Jan 2009 16:40:09 -0500

On Windows, using:

final Process p = Runtime.getRuntime().exec(...);
p.waitFor();

Invoking both start-domain and create-domain commands, it never returns
if you call waitFor() on it, where all other commands will. Previously
with the asadmin binary in glassfish v2ur2, create-domain used to return
when using wairFor(), but in v2.1 it does not either.

Furthermore, trying to kill the process with p.destroy() is hit or miss,
and usually doesnt work.

I've worked around the issue by creating a Process that it using asadmin
in interactive mode, and writing commands to the interactive asadmin shell.

This isn't the approach I'd like, since the IO for the streams of a
process are asynchronous, and I can't wait/block on each call to see
when it returns, so I have to sleep for a set amount of time after I
invoke each command to make sure I don't dump 100 commands on the
interactive shell in 1ms.



Sankar Neelakandan wrote:
> Alex,
> I do get a correct exit code when creating domain using cli. In
> your case do you get different exit codes in cli and in
> Process.execute ( ) ?. Could you please confirm ?.
>
> bash-3.00# bin/asadmin create-domain --adminport 4848 domain123
> Please enter the admin user name>admin
> Please enter the admin password>
> Please enter the admin password again>
> Please enter the master password [Enter to accept the default]:>
> Please enter the master password again [Enter to accept the default]:>
> Using port 4848 for Admin.
> Using default port 8080 for HTTP Instance.
> Using default port 7676 for JMS.
> Using default port 3700 for IIOP.
> Using default port 8181 for HTTP_SSL.
> Using default port 3820 for IIOP_SSL.
> Using default port 3920 for IIOP_MUTUALAUTH.
> Using default port 8686 for JMX_ADMIN.
> Domain being created with profile:enterprise, as specified by variable
> AS_ADMIN_PROFILE in configuration file.
> Security Store uses: NSS
> Domain domain123 created.
>
> bash-3.00# echo $?
> 0
>
> -Sankar
>
>
> Alex Sherwin wrote:
>> We've got some custom Java classes that wrap the asadmin executable
>> and are used to install and configure domains for our distributions
>> in an distributable JAR.
>>
>> Previously, the only asadmin command that did not return normally was
>> "start-domain", which was OK... we just slept for 30 seconds to
>> ensure the domain started up before proceeding.
>>
>> However, now it appears that "create-domain" no longer returns with a
>> normal exit status either. IE "p.waitFor();" where p is a Process
>> Object never returns.
>>
>> Again, we can simply not wait for this command and sleep for X amount
>> of time... but is there a specific reason why some asadmin commands
>> simply do not return normally?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>
>