|
From: Leif M. <le...@ta...> - 2006-09-14 04:41:10
|
Daniel, The problem in your code is that you are trapping the HUP signal in the Wrapper process. That is part of the problem, but that signal is not yet being sent on to the Java process. If you send the Signal to the JVM process it would work. To fix these, you will need the following in your handleHangup function: kill(jvmPid, sig_num) That said though, I have gotten this implemented for the 3.2.2 release. It is all checked in to CVS. If you could try it out it would be a big help. I have also added a new property, wrapper.signal.mode.hup, which takes the values IGNORE, SHUTDOWN, RESTART, or FORWARD. FORWARD is the default, which sends the signal on to the JVM process. The RESTART mode can be used with the wrapper.restart.reload_configuration <http://wrapper.tanukisoftware.org/doc/english/prop-restart-reload-configuration.html> property to cause the Wrapper to reload its wrapper.conf and restart the JVM when it gets a HUP signal. As I understand it, that is a common use of this signal. Are there any other signals which should be handled as well? Cheers, Leif Yazbek, Daniel (Daniel) wrote: > > Hi all, > > We are attempting to modify wrapper so that a SIGHUP can be handled by > java code, I am after some help/suggestions. > > Here is what I’ve done so far: > > Modified WrapperManager.java with: > > *public* *static* *final* *int* WRAPPER_CTRL_SIGHUP_EVENT = 205; > > Recompiled the code, javah added this definition into > org_tanukisoftware_wrapper_WrapperManager.h > > Modified wrapper_unix.c with: > > - added case in getSignalName(int signo) > > - written a handleHangup(int sig_num) function, with deceleration: > > *void* handleHangup(*int* sig_num) { > > /* Ignore any other signals while in this handler. */ > > signal(SIGHUP, SIG_IGN); > > handleCommon("HUP"); > > signal(SIGHUP, handleHangup); > > } > > - Modified wrapperInitialize() to support SIGHUP > > Modified wrapperjni_unix.c with: > > - added a handleHandup(int sig_num) function: > > *void* handleHangup(*int* sig_num) { > > signal(SIGHUP, handleHangup); > WrapperJNIHandleSignal(org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_SIGHUP_EVENT); > > } > > - Set the above handler for a SIGHUP in the init function > > So, I guess I am missing something. I cannot get the SIGHUP in the > java application from the controlEvent(int arg0) method of my class > that implements WrapperListener. > > However, when I send a sighup, I get “HUP Trapped” in the log file, > which is being generated by > > handleCommon(const char* sigName) > > I am not familiar with the architecture and a newbie to wrapper… > > Does anyone have any suggestions on where I should be heading towards > from here? > > Thanks. > > -Dan. > |