users@glassfish.java.net

Re: restart glassfishv2u2 programmatically

From: Stephen Connolly <stephen.alan.connolly_at_gmail.com>
Date: Fri, 19 Sep 2008 14:16:18 +0100

I'm sure you could write a simple java program that would check if your
glassfish is up: a simple get of http://localhost:4848 should do... if it
times out - then it's dead!

if it detects that it's dead, then fork an cmd
D:\dev\3rdparty\glassfish-v2ur2\glassfish\bin\asadmin.bat start-domain

in any case, sleep for 60 seconds before looping again

it would be much tighter than the batch file in terms of CPU

On 19 September 2008 11:11, <glassfish_at_javadesktop.org> wrote:

> I found a solution (it's more a workaround).
>
> When I start glassfish as an application then I start a gfdaemon.bat file
> too. Which trys in a loop to start the glassfish server and then waits
> 60sec.
>
> gfdaemon.bat:
>
> :loop
> rem echo start domain....
> call D:\dev\3rdparty\glassfish-v2ur2\glassfish\bin\asadmin.bat start-domain
> rem wait 60sec
> echo wait 60sec...
> ping 127.0.0.1 -n 60 -w 1000
> goto loop
>
> Now I use my Administration Client to call my restart jax-rpc webservice
> method(in that glassfish that should be restarted) which calls the
> Restarter.class and the Restarter calls the stopgf.bat.
>
> stopgf.bat:
>
> echo stop domain....
> call D:\dev\3rdparty\glassfish-v2ur2\glassfish\bin\asadmin.bat stop-domain
> exit
>
>
> It works fine expect that the daemon.bat needs 25% of my cpu. :(
>
> But at least I can restart the server from my Administration Client.
> [Message sent by forum member 'montsie' (montsie)]
>
> http://forums.java.net/jive/thread.jspa?messageID=300340
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>