|
From: Leif M. <le...@ta...> - 2006-09-15 06:47:07
|
Daniel, Yazbek, Daniel (Daniel) wrote: > 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. > Ok. This should be possible to control by using the new wrapper.signal.mode.hum property. If it is SHUTDOWN, the wrapper and JVM will be stopped. If it is RESTART, the wrapper will stay running, but the JVM will be stopped and restarted. If the wrapper.restart.reload_configuration property is also used then the wrapper.conf file can be reloaded while the JVM is down. If it is IGNORE, it is of course ignored. If it is FORWARD then the JVM will sent the signal. You can then trap it using the WrapperListener or WrapperControlEvent. This is what you want to do to keep the JVM running and reload your settings manually. Your version is basically in hardcoded FORWARD mode. > 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? > If you look closely, those two sets of functions are exclusive. You can control which is used by making use of the WRAPPER_USE_SIGACTION definition. Using sigaction rather than signal makes it possible to gain more information about where signals are coming from. I kept the old signal code in there to make it easy to go back if any problems were encountered with the sigaction implementation. It seems to be working however, so I can probably go ahead and remove that dead code. Cheers, Leif > -----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 > 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-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 > 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. >> >> > > > ------------------------------------------------------------------------ > - > 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=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Wrapper-user mailing list > Wra...@li... > https://lists.sourceforge.net/lists/listinfo/wrapper-user > > > ------------------------------------------------------------------------- > 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=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Wrapper-user mailing list > Wra...@li... > https://lists.sourceforge.net/lists/listinfo/wrapper-user > > |