< prev index next >
src/jdk.net/share/classes/jdk/net/Sockets.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 24,39 ****
--- 24,42 ----
*/
package jdk.net;
import java.net.*;
+ import java.nio.channels.*;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+ import rdma.ch.RdmaPollSelectorProvider;
+ import rdma.ch.RdmaSocketImpl;
import jdk.net.ExtendedSocketOptions.PlatformSocketOptions;
/**
* Defines static methods to set and get socket options defined by the
* {@link java.net.SocketOption} interface. All of the standard options defined
*** 348,353 ****
--- 351,421 ----
static {
Set<SocketOption<?>> s = new Socket().supportedOptions();
available = s.contains(ExtendedSocketOptions.TCP_QUICKACK);
}
}
+
+ /**
+ * Creates an unconnected RDMA socket
+ */
+ public static Socket openRdmaSocket() throws IOException {
+ RdmaSocketImplFactory factory = new RdmaSocketImplFactory();
+ SocketImpl impl = factory.createSocketImpl();
+ return new Socket(impl) { };
+ }
+
+ /**
+ * Creates an unbound RDMA server socket
+ */
+ public static ServerSocket openRdmaServerSocket() throws IOException {
+ RdmaSocketImplFactory factory = new RdmaSocketImplFactory();
+ SocketImpl impl = factory.createSocketImpl();
+ return new ServerSocket(impl) { };
+ }
+
+ /**
+ * Opens a RDMA socket channel.
+ *
+ * @return A new RDMA socket channel
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public static SocketChannel openRdmaSocketChannel() throws IOException {
+ return RdmaPollSelectorProvider.provider().openSocketChannel();
+ }
+
+ /**
+ * Opens a RDMA server-socket channel.
+ *
+ * <p> The new channel is created by invoking the {@link
+ * java.nio.channels.spi.SelectorProvider#openServerSocketChannel
+ * openServerSocketChannel} method of the system-wide default {@link
+ * java.nio.channels.spi.SelectorProvider} object.
+ *
+ * <p> The new channel's socket is initially unbound; it must be bound to a
+ * specific address via one of its socket's {@link
+ * java.net.ServerSocket#bind(SocketAddress) bind} methods before
+ * connections can be accepted. </p>
+ *
+ * @return A new RDMA server socket channel
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public static ServerSocketChannel openRdmaServerSocketChannel()
+ throws IOException {
+ return RdmaPollSelectorProvider.provider().openServerSocketChannel();
+ }
+
+ /**
+ * Opens a RDMA selector.
+ *
+ * @return A new RDMA selector
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public static Selector openRdmaSelector() throws IOException {
+ return RdmaPollSelectorProvider.provider().openSelector();
+ }
}
< prev index next >