[systemd-devel] Socket activation for Java services
Jian Lin
lj at linjian.org
Thu Dec 27 04:56:41 PST 2012
Thanks! I will have a try.
On Thu, 27 Dec 2012 03:38:08 -0800
David Strauss <david at davidstrauss.net> wrote:
> 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]
--
Jian Lin (林健)
http://linjian.org
More information about the systemd-devel
mailing list