|
From: Leif M. <le...@ta...> - 2004-02-20 04:26:27
|
Jennifer, As you have pointed out, the Wrapper is only able to monitor the health of the JVM as a whole. If a piece of code within the application stops working, there is currently no way for the Wrapper to detect that. I will give some more thought to how the Wrapper might be able to help with this problem in the future. For now however, rather than modifying the Wrapper. I would suggest creating a simple thread which loops and constantly compares the current time with a timeout value set before and after calls to the code you are worried about. If the thread ever decides that it has timed out then it could simply make a call to WrapperManager.restart(); Playing with the way the Wrapper and JVM communicate is not advisable. Long term, you will probably end up running into other problems. Cheers, Leif Jennifer Kolar wrote: > Actually- in case anyone is interested,I figured out my own soln... > > I added another member variable in WrapperManager "m_ignorePings" and > a setter to set it to true or false (false by default). > in WrapperManager in the case statement that is responding to input > from the native side, if the message is "ping" and the > value of m_ignorePings is true, the WrapperManager simply doesn't send > a ping response back. I also exposed the ability for the child to tell > the wrappermanager to > send a ping to the native side so that when I am in this ignorePings > state, my application can still let the native side know the VM is > alive on its own terms. > > then, in my child application- I can set the ignorePings state to true > whenever I am entering a method I think will potentially hang, and set > it to false when I leave it. > > No C or JNI changes needed. > Jennifer > > > Jennifer Kolar wrote on 2/18/2004, 11:34 AM: > >> I have an application that I am launching via the wrapper as a >> service from the simplewrapper app. >> I have the problem that the JVM pinging in the wrapper is still >> happening successfully but the inner process in hung.. and since the >> wrapper thinks >> the JVM is still alive, it allows the process to continue nicely. >> >> Leif, anyone, have any ideas on how to work around this. >> >> One thought I have had- but I don't see it exposed in any way in the >> JNI layer is to tell the wrapper to Stop and Start its internal ping. >> It is easy expose a ping method >> on the wrapper that the child application can call.. and in that >> way--- if I think my child app is entering a dangerous method, I can >> have the wrapper stop its own pinging, have my >> app send the ping itself, and then once I am out of dangerous >> territory.. restart the internal pinging in the wrapper. Any ideas on >> how to do this? >> >> thanks >> Jennifer > |