RE: Remaining tasklist for alpha?
"Bordet, Simone" <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Lachezar, > Actually the idea was borrowed from jboss, but mine was > quite lightweight. > It did not implement any dependancies, but rather I had many deployer > MBeans, and each would execute the shutdown procedure upon it's > deregistration. > > > Also there there is a shutdown hook that calls stop on this > > root MBean. > > Mmmmm... I wouldn't like that. That would fix the Root MBean to be a > "singleton", while my idea was, that the Root MBean is just like other > loaders, but if created/started from the main application method. Not sure I have understood, ca you expand on this ? If you have 2 root mbeans, how do you stop them ? Am I correct in saying that you have only one shutdown hook that calls stop on both ? How do you stop only one of the two ? > > I think this approach requires a lifecycle interface > > with at least start()/stop() methods, so that the root > > MBean can invoke these methods (although > > reflection-style-JMX-invocation allows you to "try" to > > invoke stop() and if there is no stop() method it does not matter). > > Well... I do not think this is quite useful. Of course it > will work, and works, but I would need to perform more complex > startup/shutdown procedure, and this would not be my case. > A typical problem of mine was, that before invoking > operations I needed to > set up Attributes according to my liking (i.e. ports, Jndi names, conf > settings, etc., etc.) Yes, I have the same problem. Have you seen the post I made some day ago about a proposed XML for such a configuration file, right ? So here we agree I think. I like your idea of having 2 sections, one for startup, and one for shutdown, it's cleaner than having 2 files as I have now, though requires a bit more of logic in the parser: "if shutting down, ignore the startup section". > > What I'm often facing is that I would like to start my > > standalone server from a remote shell, and also from a > > remote shell, shut it down (no physical access to > > hardware), and then to close that shell. > > I would like to have a startup.sh script and a shutdown.sh > > script, very much like Tomcat's (which relies on sockets). > > How about... Writing a common Main class with a common main > method, that will require a startup/shutdown script as a parameter? This > class can set up the Shutdown handler, and eventualy (if available in the JVM) > interrupt handlers, that will correctly handle SIG_HUP, SIG_QUIT, > SIG_TERM etc. to perform shutdown or restart? > How about that? > > One can than do: > <startup.sh> > java -cp $CP$ mx4j.startup.Main /home/mx4j/server.mx4j.xml > &> /home/mx4j/server.mx4j.log & > echo $! > /home/mx4j/server.mx4j.pid > </startup.sh> > > <restart.sh> > kill -HUP `cat /home/mx4j/server.mx4j.pid` > </restart.sh> > > <shutdown.sh> > kill `cat /home/mx4j/server.mx4j.pid` > </shutdown.sh> Cool for Linux/Unix, bad for Windows: no PIDs on Windows, and not so many signals you can easily interact with. I guess this is the same reason the Tomcat guys use a socket instead of the PIDs. > > Instead of sockets I can of course rely on JSR 160, but that > > requires a lot of machinery to be present: the > > RMIConnectorServer and a naming service on 1099, otherwise I > > am reduced to parse JMXConnectorServer output or PIDs, sigh. > > Actually it is a rare case where there are no adapters in the MBean > server... Am I correct ? > However the shutdown script will need to know where and how > to find the > MBean server vm, and still we need a shutdown(service) MBean, > that will be > called in order to shutdown the server. Right? Right. But how do you find the server JVM and the right MBeanServer is the culprit of the problem, no matter if you have or not a connector server in your MBeanServer. > > I would like very much to write a startup.xml and a > > shutdown.xml with information on how to start and how to > > stop my server; and a startup.sh and shutdown.sh that feed > > these 2 xml to a configuration loader. > > Well except for the part that I would like the shutdown and startup > procedure in one file I think we speak the same language... Agree, better one file only. To recap: we agree on the XML syntax (details apart), but it's still not clear to me how to have a portable shutdown solution if not using sockets. A server socket on 127.0.0.1 is also fairly "secure". Imagine a situation where I need no JSR 160 connectors, but I like to have the HTTP adaptor only for viewing the mbeans. How do I communicate with that JVM and that MBeanServer ? Thanks, Simon ------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/