Add native JDK support for UDS on Java 16+#262
Conversation
e356aaf to
675dddf
Compare
34af4da to
c888794
Compare
c888794 to
619e4d9
Compare
This comment has been minimized.
This comment has been minimized.
|
@carlosroman Any update on this ? |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7f9688016
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Could we add a test around this class?
There was a problem hiding this comment.
Pull request overview
This PR adds an optional native-JDK (Java 16+) Unix Domain Socket (UDS) implementation path, reducing reliance on jnr-unixsocket when running on modern JDKs while keeping compatibility with older versions.
Changes:
- Adds
enableJdkSocketconfiguration and plumbing through the builder/client to enable native JDK UDS support on Java 16+. - Introduces
VersionUtilsfor Java version parsing plus reflective access toStandardProtocolFamily.UNIXandUnixDomainSocketAddress. - Updates
UnixStreamClientChannelto use nativeSocketChannelfor UDS stream connections when enabled; adjusts tests accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/timgroup/statsd/NonBlockingStatsDClient.java | Passes enableJdkSocket into channel creation. |
| src/main/java/com/timgroup/statsd/NonBlockingStatsDClientBuilder.java | Adds enableJdkSocket option and uses it during unix URL resolution. |
| src/main/java/com/timgroup/statsd/UnixStreamClientChannel.java | Implements native-JDK UDS stream connect/write behavior behind a Java 16+ + flag gate. |
| src/main/java/com/timgroup/statsd/UnixDatagramClientChannel.java | Documents why native JDK UDS datagram isn’t available yet. |
| src/main/java/com/timgroup/statsd/VersionUtils.java | Adds Java version parsing and reflection helpers for Java 16+ UDS APIs. |
| src/test/java/com/timgroup/statsd/BuilderAddressTest.java | Adjusts address assertions to tolerate native-JDK address types. |
| src/test/java/com/timgroup/statsd/NonBlockingStatsDClientTest.java | Updates overridden createByteChannel signatures for the new parameter. |
| src/test/java/com/timgroup/statsd/UnixStreamSocketDummyStatsDServer.java | Minor refactor in unix socket bind setup. |
| src/test/java/com/timgroup/statsd/UnixStreamSocketTest.java | Tweaks UDS stream test behavior/assertions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3815fe69db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e71516eedc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5c09ed16a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2c667061a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This PR introduces native JDK support for UDS, which was added in Java 16: https://openjdk.org/jeps/380. This is done by:
enableJdkSocketto enable native JDK support for UDS for compatible versions (Java 16+)NonBlockingStatsDClient,NonBlockingStatsDClientBuilder, andUnixStreamClientChannel.UnixDatagramClientChannelcannot be updated at this time.VersionUtilsfile that parses Java versions.This PR follows DataDog/dd-trace-java#8314, which added native JDK support to
dd-trace-java. With native support, we can reduce third party (i.e.jnr-unixsocket) dependencies.