adding rsockets support into JDK
Alan.Bateman at oracle.com
Sat Nov 24 09:11:30 UTC 2018
On 23/11/2018 21:38, Lu, Yingqi wrote:
> Hi Alan/Chris,
> I am not sure when IPv4-mapped addresses will be supported in rsocket.
> Based on the suggestions earlier this week, I completed the version 19 of the patch at http://cr.openjdk.java.net/~ylu/8195160.19
> Inside that, I have done:
> 1. Totally removed IPv6 support for rsocket, and removed -Djava.net.preferIPv4Stack=true in all the test cases.
> 2. Instead of using "librdmacm.so", "librdmacm.so.1" is used for the library name.
> 3. Caught java.lang.ExceptionInInitializerError when rdma library is not installed in the system. A UOE is thrown instead.
> 4. In the tests, modified both RsocketTest.java RdmaSocketsTest.java to double check UOE on all the platforms when rdma library is not installed.
> Then, I just saw your emails on IPv6 handling :-) I can see both advantages and disadvantages of either keeping or removing IPv6 support for rsocket, and totally fine whichever direction you decide. If we want to use protocol family approach, would you please point me to an example so that I can follow?
I searched the archives of linux-rdma mailing but couldn't find any
discussion on this topic. I wonder if we should post something there
(assuming it's the right list) to see if this has been explored. We are
making decision on a JDK-specific API so it's important to have as much
information as possible. If we can't get the information then the
initial factory methods will need a ProtocolFamily as Chris points out.
The alternative, which is to take a chance that support for IPv4-mapped
IPv6 addresses will be added in the future, means we could get stuck
with factory methods that create SocketChannel/Sockets that are forever
IPv4-only. Adding factory methods that take a protocol family does not
preclude you from adding no-arg factory methods in the future of course.
The only example of this type of thing in the JDK is DatagramChannel
which has a factory method to create a datagram channel to use a
specific protocol family. This method is needed for multicasting as
there is no guarantee that a DatagramChannel can join an IPv4 multicast
group when IPv6 is enabled. The disadvantage of this API is that
multicasting applications need to know at DatagramChannel create time if
it will be used to join an IPv4 or IPv6 multicast group. If you change
the RdmaSockets.openXXX methods to do the same then it would be similar.
It may be okay in libraries where the creation, binding, and connecting
are the same library but problematic if you want to pass an unbound or
not-connected SocketChannel or Socket to a library or other part of a
system that expects to bind or connect.
More information about the nio-dev