[systemd-devel] Socket activation for Java services
David Strauss
david at davidstrauss.net
Thu Dec 27 03:38:08 PST 2012
On Mon, Dec 24, 2012 at 7:29 AM, Jian Lin <lj at linjian.org> wrote:
> I want to use systemd to manage some services written in Java.
> I found it is easy to write service units for starting and stopping
> the services.
> However, I also hope to implement the socket activation for Java services,
> in order to start the service when receiving the first connection.
> Should I encapsulate sd-daemon.c or something else by JNI,
> or hack the implementation of Socket class?
> Or any other suggestions?
You probably want to wrap the socket functions from sd-daemon.c in
something like this:
http://www.kfu.com/~nsayer/Java/jni-filedesc.html
There's also an interesting example here:
http://alex.tapmania.org/2010/10/passing-file-pointer-to-ndk.html
There doesn't appear to be a cleaner approach aside from disruptively
subclassing Java socket code.
--
David Strauss
| david at davidstrauss.net
| +1 512 577 5827 [mobile]
More information about the systemd-devel
mailing list