1

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?

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

1 Answers1

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