Class SystemdNotify
NOTIFY_SOCKET. Not meant for direct usage.
On Java 17 to 21, the notifications are sent by calling sd_notify from the native libsystemd library, through JNA. On Java 22 and later, they
are sent directly to the socket, with the Foreign Function and Memory API, so that neither JNA nor libsystemd are needed, except for vsock:
addresses, or as a fallback (see NotifyChannel).
- Author:
- Joao Silva
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose()Attempts to orderly close the systemd integration channel.static voidRegisters a JVM shutdown hook that closes the systemd integration channel.
-
Method Details
-
registerShutdownHook
public static void registerShutdownHook()Registers a JVM shutdown hook that closes the systemd integration channel.- See Also:
-
close
public static void close()Attempts to orderly close the systemd integration channel.Normally, the integration channel will be closed when the JVM shuts down.
However, you may wish of explicitly close the integration channel, to ensure that all closeable resources are effectively closed.
As such, this method should only be called at most once during the lifecycle of the JVM.Currently this does nothing, as no integration channel keeps resources open between notifications: the native libsystemd library opens a socket for each notification, and so does the channel used on Java 22 and later.
-