26 package jdk.net; |
26 package jdk.net; |
27 |
27 |
28 import java.net.ProtocolFamily; |
28 import java.net.ProtocolFamily; |
29 import java.net.ServerSocket; |
29 import java.net.ServerSocket; |
30 import java.net.Socket; |
30 import java.net.Socket; |
|
31 import java.net.StandardProtocolFamily; |
31 import java.nio.channels.Selector; |
32 import java.nio.channels.Selector; |
32 import java.nio.channels.ServerSocketChannel; |
33 import java.nio.channels.ServerSocketChannel; |
33 import java.nio.channels.SocketChannel; |
34 import java.nio.channels.SocketChannel; |
|
35 import java.nio.channels.spi.SelectorProvider; |
34 import java.io.IOException; |
36 import java.io.IOException; |
35 import java.util.Objects; |
37 import java.util.Objects; |
36 import jdk.internal.net.rdma.RdmaPollSelectorProvider; |
38 import jdk.internal.net.rdma.RdmaPollSelectorProvider; |
37 import jdk.internal.net.rdma.RdmaSocketProvider; |
39 import jdk.internal.net.rdma.RdmaSocketProvider; |
38 |
40 |
39 /** |
41 /** |
40 * Factory methods for creating RDMA-based TCP sockets and channels. |
42 * Factory methods for creating RDMA-based TCP sockets and socket channels. |
41 * |
43 * |
42 * <p>The {@link #openSocket(ProtocolFamily family) openSocket} and {@link |
44 * <p>The {@link #openSocket(ProtocolFamily) openSocket} and {@link |
43 * #openServerSocket(ProtocolFamily family) openServerSocket} methods |
45 * #openServerSocket(ProtocolFamily) openServerSocket} methods create RDMA-based |
44 * create RDMA-based TCP sockets. |
46 * TCP sockets. |
45 * |
47 * |
46 * <p>The {@link #openSelector() openSelector}, {@link |
48 * <p>The {@link #openSelector() openSelector}, {@link |
47 * #openSocketChannel(ProtocolFamily family) openSocketChannel}, and {@link |
49 * #openSocketChannel(ProtocolFamily) openSocketChannel}, and {@link |
48 * #openServerSocketChannel(ProtocolFamily family) openServerSocketChannel} |
50 * #openServerSocketChannel(ProtocolFamily) openServerSocketChannel} methods |
49 * methods create selectors and selectable channels for use with RDMA sockets. |
51 * create selectors and selectable channels for use with RDMA sockets. These |
50 * These objects are created by a {@link java.nio.channels.spi.SelectorProvider |
52 * selectors and channels are created by the RDMA selector provider, which is |
51 * SelectorProvider} that is not the default {@code SelectorProvider}. |
53 * not the {@linkplain SelectorProvider#provider() default} system-wide selector |
52 * Consequently, selectable channels to RDMA sockets may not be multiplexed |
54 * provider. Consequently, selectable channels to RDMA sockets may not be |
53 * with selectable channels created by the default selector provider. Its |
55 * multiplexed with selectable channels created by the default system-wide |
54 * selector provider does not support datagram channels and pipes. |
56 * selector provider. The RDMA selector provider does not support datagram |
55 * The {@link java.nio.channels.spi.SelectorProvider#openDatagramChannel |
57 * channels or pipes. Its {@link SelectorProvider#openDatagramChannel |
56 * openDatagramChannel} and |
58 * openDatagramChannel} and {@link SelectorProvider#openPipe openPipe} methods |
57 * {@link java.nio.channels.spi.SelectorProvider#openPipe openPipe} methods |
59 * throw {@link UnsupportedOperationException UnsupportedOperationException}. |
58 * throw {@link java.lang.UnsupportedOperationException |
60 * |
59 * UnsupportedOperationException}. |
61 * @implNote The RDMA selector provider supports socket channels of type |
|
62 * {@link StandardProtocolFamily#INET INET} and {@link |
|
63 * StandardProtocolFamily#INET6 INET6}. Its {@link |
|
64 * SelectorProvider#openSocketChannel() openSocketChannel} and {@link |
|
65 * SelectorProvider#openServerSocketChannel() openServerSocketChannel} |
|
66 * methods create selectable channels with a family of {@link |
|
67 * StandardProtocolFamily#INET6 INET6}, if the underlying platform supports |
|
68 * IPv6. Otherwise, it creates selectable channels with a family of {@link |
|
69 * StandardProtocolFamily#INET INET}. |
60 * |
70 * |
61 * @since 13 |
71 * @since 13 |
62 */ |
72 */ |
63 public class RdmaSockets { |
73 public class RdmaSockets { |
64 |
74 |