sd_notify() from Java

前端 未结 1 1944
醉酒成梦
醉酒成梦 2021-02-15 21:09

I have a Java service (implemented using Dropwizard) which I\'m launching from a user instance of systemd. So far so good. Now I would like to use systemd\'s notification feat

1条回答
  •  天涯浪人
    2021-02-15 21:26

    I found this implementation which does use system hooks, but at least doesn't require JNA/JNI.

    https://gist.github.com/yrro/18dc22513f1001d0ec8d

    As you say, systemd uses sockets referenced by an environment variable (System.getenv("NOTIFY_SOCKET") in the code), so I'd imagine there may also be a way to use a Java Socket, although I'd imagine a lot of research and/or trial-and-error would be required.

    0 讨论(0)
提交回复
热议问题