On Sun, 21 Nov 2010 21:52:24 +0000 (UTC)
Martin Gregorie <martin@address-in-sig.invalid> wrote:
On Sun, 21 Nov 2010 11:58:40 -0800, Steve Sobol wrote:
Yes. Really, my goals are (a) tight integration with the OS and (b)
convenience. I mean, sure, you could use JMX to control your app. But
how are you going to launch that app? I'm not all that familiar with
JMX/RMI/CORBA, but my impression is that you still need some mechanism
to instantiate and control Java objects.
In a *nix environment all you need do is "java progname args &" and its
off and running as a background task, or you can use the 'daemon' shell
script function.
[snip]
Agreed, although as mentioned, part of the problem with "java progname
args &" is what shows up when you do a 'ps' -- I want to be able to see my
app's name, not "java" followed by a long list of arguments.
Anything else is done by sending signals to the service, not something
Java can easily handle
Martin, you are a genius. :) I'd completely forgotten about using
signals... probably because it's been a LONG time since the last time I
did any serious *ix programming.
Say I have a program written in Java - let's call it
com.lobosstudios.MyService
I use LaunchJVM to create a native launcher, let's call it
linux-native-service
If you send a signal to such a program, you'll be sending the signal to my
C++ stub (linux-native-service), which can trap the signal and take the
appropriate action (i.e., call one of the methods exposed by
com.lobosstudios.MyService).