users@glassfish.java.net

How to use -XX:OnOutOfMemory with GlassFish

From: <glassfish_at_javadesktop.org>
Date: Fri, 08 May 2009 00:00:55 PDT

Hi,

I would like to setup up a GlassFish with the following JVM option:

-XX:OnOutOfMemoryError="kill -9 %p"

For production robust Installation I wan't to be sure that the server restarts in case of an OOM event. To achive this, I want to embed the start of GlassFish in a shell script which checks the GlassFish jvm return code and if the code is 137 (128 plus signalNumber), I will restart GlassFish automatically.

But I found no mechansim to start the GlassFish in a foreground session. It runs always as a daemon process even when I start it with the asadmin verbose mode. This mode seems to run GlassFish in a foreground session, but this is not true. It just prints out the console output, but the PID wich is expanded by %p is not the real GlassFish PID - I think it's the launchers PID.

Has someone an idea to do this?

Thanks in advance,
 Frank
[Message sent by forum member 'fmeili' (fmeili)]

http://forums.java.net/jive/thread.jspa?messageID=345492