|
From: Yazbek, D. \(Daniel\) <dy...@av...> - 2006-09-15 05:15:15
|
Leif, Thank you for your suggestion, I added the kill(jvmPid, sig_num) statement in my sigActionHangup function and it worked! To put things into context, we would like to use SIG_HUP to reload the config file used in the java application that is wrapped up within wrapper. We do not want to terminate and start the java application, nor do we want to terminate and start the wrapper application (although, we don't mind if wrapper re-reads its config... this will never change for us). It is important that the JVM is not interrupted. I would be happy to investigate v3.2.2 to see if it meets our needs mentioned above. I will let you know how I go. Further, in wrapper_unix.c I noticed you have the following two functions: void sigActionTermination(int sigNum, siginfo_t *sigInfo, void *na) void handleTermination(int sig_num) These two methods seem to be near identical in functionality, and for my implementation of SIG_HUP, I have followed this convention. I have the following two functions: void sigActionHangup( int sigNum, siginfo_t *sigInfo, void *na) void handleHangup(int sig_num) With some debug logging, I have noticed that when I send a SIG_HUP to wrapper, it is caught in the sigActionHangup method (i.e. not the handleHangup method)... My question to you is, why are there two handle methods defined for each signal type? What is the difference? And when are each used? Thanks. -Daniel. -----Original Message----- From: wra...@li... [mailto:wra...@li...] On Behalf Of Leif Mortenson Sent: Thursday, 14 September 2006 14:41 To: wra...@li... Subject: Re: [Wrapper-user] Support SIGHUP Handling Daniel, The problem in your code is that you are trapping the HUP signal in the=20 Wrapper process. That is part of the problem, but that signal is not yet being=20 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.=20 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=20 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=20 wrapper.restart.reload_configuration=20 <http://wrapper.tanukisoftware.org/doc/english/prop-restart-reload-confi guration.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=20 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 =3D 205; > > Recompiled the code, javah added this definition into=20 > 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);=20 > 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=20 > java application from the controlEvent(int arg0) method of my class=20 > that implements WrapperListener. > > However, when I send a sighup, I get "HUP Trapped" in the log file,=20 > 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=20 > from here? > > Thanks. > > -Dan. > ------------------------------------------------------------------------ - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Wrapper-user mailing list Wra...@li... https://lists.sourceforge.net/lists/listinfo/wrapper-user |