Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: javalib java.net.channel.DatagramChannel #3910

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

RustedBones
Copy link
Contributor

First step for #3676 with DatagramChannel.

Implementation of java.nio.channels classes based on previous work done in #978

Creation of a Net helpers to factorize code between socket and channels.

@@ -0,0 +1,5 @@
package java.net

trait ProtocolFamily {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see this in the JDK java.net documentation, so probably
needs to be private, probably private[net]
(I believe that one can have private traits).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is part of the java public API

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I learned... Thank you for the URL, got any kitchen sinks hidden in there?

@@ -505,3 +511,19 @@ private[net] object ip6 {
def IPV6_MULTICAST_HOPS: CInt = in.IPV6_MULTICAST_HOPS
}
}

@extern
object async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be private[net] also. See the declaration just above.

In a better world, or at least more consistent world SocketHelpers would also be private. I believe it is not here because something
in unit-tests reaches into SocketHelpers and executes a method.
No one, including me, has gotten around to removing that wart.

I'll have to dive deeper into the concepts here later (days).

val dc = DatagramChannel.open()
try {
f(dc)
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see channel getting closed on both success and exception paths. We have a lot of technical debt in SN with resources (files) not getting closed when an assertion fails.

@LeeTibbert
Copy link
Contributor

LeeTibbert commented May 11, 2024

RustedBones,

You have done a lot of work here & the improvement shows.

My CI run finished and my pillow is calling so I can not do more tracing tonight.

From what I have seen so far this approach is promising enough that I will spend more time studying it.
Seems like there will be a reduction in code & complexity.

Across the board, it seems like some of the new, non-JVM classes need to be private. (private [net]).
I am aware that not everything can get done at once; trying to be a good reviewer, not a harpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants