adding rsockets support into JDK

Alan Bateman Alan.Bateman at oracle.com
Mon Jun 25 11:52:00 UTC 2018


On 23/06/2018 01:56, Lu, Yingqi wrote:
> Hi All,
>
> Here is the version 7 of the patch. http://cr.openjdk.java.net/~ylu/8195160.07/
>
> In this version, I did:
>
> 1. Added SO_LINGER supports (librdmacm supports it) to RDMA based sockets and socket channels. Tests are also updated with this newly added Socket Option.
>
> 2. Added a private static variable rdmaOptionsSet to both java.net.Socket and java.net.ServerSocket. This way, I think the supportedOptions will return correct values between RDMA based sockets and regular sockets regardless of who is created first. Please let me know if I missed any cases here.
>
I went over the API again. The factory methods don't have complete 
javadoc yet and I'm happy to help with that, see below.

The other part of the API is jdk.net.RdmaSocketOptions. The SQSIZE, 
RQSIZE and INLINE constants are currently public so they are leaking 
into the API. The API elements are RMDA_SQSIZE, RMDA_RQSIZE and 
RQSIZE_INLINE and these will need javadoc. Can you 
java.net.StandardSocketOption as an example of how the existing socket 
options are specified?

-Alan.


A suggestion to add to the jdk.net.Sockets class description:

  * <p> The {@link #openRdmaSelector() openRdmaSelector}, {@link
  * #openRdmaSocketChannel() openRdmaSocketChannel}, and {@link
  * #openRdmaServerSocketChannel() openRdmaServerSocketChannel} methods
  * create selectors and selectable channels for use with RDMA sockets.
  * These objects are created a {@link 
java.nio.channels.spi.SelectorProvider
  * SelectorProvider} that is not the default {@code SelectorProvider}.
  * Consequently, selectable channels to RDMA sockets may not be multiplexed
  * with selectable channel created by the default selector provider. The
  * selector provider does not support datagram channels, its {@code
  * openDatagramChannel} methods throw {@link 
UnsupportedOperationException}.

A suggestion for openRdmaSocketChannel:

     /**
      * Opens a socket channel to a RDMA socket. A newly-created socket 
channel
      * is {@link SocketChannel#isOpen() open}, not yet bound to a {@link
      * SocketChannel#getLocalAddress() local address}, and not yet
      * {@link SocketChannel#isConnected() connected}.
      *
      * <p> A socket channel to a RDMA socket supports all of the socket 
options
      * specified by {@code SocketChannel}. In addition, it also 
supports the
      * socket options specified by {@link RdmaSocketOptions}.
      *
      * @apiNote The rsocket implementation on Linux only supports IPv4 
addresses.
      * Consequently, attempting to bind or connect to an IPv6 address 
will fail
      * with {@code UnsupportedAddressTypeException}.
      *
      * @throws IOException
      *         If an I/O error occurs
      * @throws UnsupportedOperationException
      *         If RDMA sockets are not supported on this platform
      *
      * @since N
      */

A suggestion for openRdmaServerSocketChannel:

     /**
      * Opens a server-socket channel to a RDMA socket. A newly-created 
socket
      * channel is {@link SocketChannel#isOpen() open} but not yet bound 
to a
      * {@link SocketChannel#getLocalAddress() local address}.
      *
      * @apiNote The rsocket implementation on Linux only supports IPv4 
addresses.
      * Consequently, attempting to bind to an IPv6 address will fail with
      * {@code UnsupportedAddressTypeException}.
      *
      * @throws IOException
      *         If an I/O error occurs
      * @throws UnsupportedOperationException
      *         If RDMA sockets are not supported on this platform
      *
      * @since N
      */

A suggestion for openRdmaSelector:

     /**
      * Opens a selector to multiplex selectable channels to RDMA sockets.
      *
      * @throws IOException
      *         If an I/O error occurs
      * @throws UnsupportedOperationException
      *         If RDMA sockets are not supported on this platform
      *
      * @since N
      */

A suggestion for openRdmaSocket:

     /**
      * Creates an unconnected RDMA socket.
      *
      * <p> A RDMA socket supports the same socket options that that {@code
      * java.net.Socket} defines. In addition, it also supports the 
socket options
      * specified by {@link RdmaSocketOptions}.
      *
      * @apiNote The rsocket implementation on Linux only supports IPv4 
addresses.
      * Consequently, attempting to bind or connect to an IPv6 address 
will fail
      * with {@code IllegalArgumentException}.
      *
      * @throws IOException
      *         If an I/O error occurs
      * @throws UnsupportedOperationException
      *         If RDMA sockets are not supported on this platform
      *
      * @since N
      */

A suggestion for openRdmaServerSocket:

     /**
      * Creates an unbound RDMA server socket.
      *
      * <p> A RDMA socket supports the same socket options that that {@code
      * java.net.ServerSocket} defines.
      *
      * @apiNote The rsocket implementation on Linux only supports IPv4 
addresses.
      * Consequently, attempting to bind to an IPv6 address will fail with
      * {@code IllegalArgumentException}.
      *
      * @throws IOException
      *         If an I/O error occurs
      * @throws UnsupportedOperationException
      *         If RDMA sockets are not supported on this platform
      *
      * @since N
      */


More information about the nio-dev mailing list