Reputation: 40730
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?
Upvotes: 2
Views: 1062
Reputation: 310985
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
.
Upvotes: 5