faljse / sdnotify Goto Github PK
View Code? Open in Web Editor NEWSDNotify implements the systemd notification protocol in Java.
License: GNU Lesser General Public License v2.1
SDNotify implements the systemd notification protocol in Java.
License: GNU Lesser General Public License v2.1
I think it's beneficial if users of the library have a consistent way of sending the process PID to SystemD which is consistent with the check in determinePid().equals(watchdog_pid)
Hello,
Unfortunately, it seems like 1.2 won't start for us. Here is the relevant piece of stacktrace :
Caused by: java.lang.Error: Structure.getFieldOrder() on class info.faljse.SDNotify.jna.CLibrary$SockAddr returns names ([addr, family]) which do not match declared field names ([addr])
at com.sun.jna.Structure.getFields(Structure.java:1027)
at com.sun.jna.Structure.deriveLayout(Structure.java:1172)
at com.sun.jna.Structure.calculateSize(Structure.java:1097)
at com.sun.jna.Structure.calculateSize(Structure.java:1049)
at com.sun.jna.Structure.allocateMemory(Structure.java:403)
at com.sun.jna.Structure.<init>(Structure.java:194)
at com.sun.jna.Structure.<init>(Structure.java:182)
at com.sun.jna.Structure.<init>(Structure.java:169)
at com.sun.jna.Structure.<init>(Structure.java:161)
at info.faljse.SDNotify.jna.CLibrary$SockAddr.<init>(CLibrary.java:70)
at info.faljse.SDNotify.SDNotify.<init>(SDNotify.java:46)
at info.faljse.SDNotify.SDNotify.getInstance(SDNotify.java:184)
at info.faljse.SDNotify.SDNotify.isAvailable(SDNotify.java:59)
...
If that's any help : the OS is CentOS Linux release 7.5.1804, kernel is 3.10.0-862.11.6.el7.x86_64.
Cheers
First of all, thank you for this library!
I have a question/potential issue with systemd
version 208
It seems my platform exposes notify socket like so:
u_dgr UNCONN 0 0 @/org/freedesktop/systemd1/notify 7815 * 0 users:(("systemd",1,7))
Which means that this is abstract UNIX domain socket
In my app: SystemdNotify.ready("some info")
fails with (stack edited):
com.sun.jna.LastErrorException: [107] Transport endpoint is not connected
at info.faljse.SDNotify.jna.CLibrary.send(Native Method)
at info.faljse.SDNotify.io.NativeDomainSocket.send(NativeDomainSocket.java:58)
at info.faljse.SDNotify.SDNotify.sendString(SDNotify.java:193)
at info.faljse.SDNotify.SDNotify.sendNotify(SDNotify.java:70)
I have a suspicion that the @
character should by manually swapped into NULL byte before using here:
CLibrary.SockAddr sockAddr = new CLibrary.SockAddr(socketName);
sd = new NativeDomainSocket();
sd.connect(sockAddr);
Could you confirm it is indeed an issue?
If not, could you help me understand the problem with [107] Transport endpoint is not connected
?
The Project is supposed to run with jdk 1.8 but it uses a method which is marked @since 9
and therefore doesn't really work on jdk 1.8, see Stacktrace below:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Exception in thread "main" java.lang.NoSuchMethodError: java.util.List.of(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;
at info.faljse.SDNotify.jna.CLibrary$SockAddr.getFieldOrder(CLibrary.java:81)
at com.sun.jna.Structure.fieldOrder(Structure.java:1044)
at com.sun.jna.Structure.getFields(Structure.java:1098)
at com.sun.jna.Structure.deriveLayout(Structure.java:1265)
at com.sun.jna.Structure.calculateSize(Structure.java:1192)
at com.sun.jna.Structure.calculateSize(Structure.java:1144)
at com.sun.jna.Structure.allocateMemory(Structure.java:426)
at com.sun.jna.Structure.<init>(Structure.java:216)
at com.sun.jna.Structure.<init>(Structure.java:204)
at com.sun.jna.Structure.<init>(Structure.java:191)
at com.sun.jna.Structure.<init>(Structure.java:183)
at info.faljse.SDNotify.jna.CLibrary$SockAddr.<init>(CLibrary.java:75)
at info.faljse.SDNotify.SDNotify.<init>(SDNotify.java:48)
at info.faljse.SDNotify.SDNotify.getInstance(SDNotify.java:186)
at info.faljse.SDNotify.SDNotify.sendNotify(SDNotify.java:72)
According to comment
I think the encoding should be adjusted to UTF-8 because of the SystemD expectation being UTF-8 (as correctly stated in the comment) which is also documented in https://www.freedesktop.org/software/systemd/man/sd_notify.html
The README mentions import info.faljse.systemdnotify.SDNotify
, but this leads to an error message claiming the systemdnotify
package cannot be found. Should it be changed to say import info.faljse.SDNotify.SDNotify
, which seems to work, instead?
Hi I'm unable to get SDNotify 1.4 from maven central, only 1.3. Would you mind uploading it? (thanks so much for this library btw!)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.