systemd supports socket activation, which means that sockets will be passed to the daemon process as open file descriptors. Is there any way to retrieve and use these sockets from Java?
Asked
Active
Viewed 919 times
1
-
Yes. As I said in the comments to your [last question](http://stackoverflow.com/q/27176303/2970947), use JNI and/or JNA. – Elliott Frisch Nov 27 '14 at 17:56
1 Answers
4
Yes, this is what System.inheritedChannel()
is for.
On the systemd side, you should be able to make your service file pass the socket as fd 0 (which is what Java expects) by setting StandardInput=socket
.

Andrew Aylett
- 39,182
- 5
- 68
- 95

user207421
- 305,947
- 44
- 307
- 483
-
Thanks, that's the pointer I needed. Not actually tried it, mind, but it seems plausible :). – Andrew Aylett Nov 27 '14 at 19:46