--- a/jdk/src/share/classes/com/oracle/net/Sdp.java Mon Apr 07 08:09:55 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.oracle.net;
-
-import java.net.Socket;
-import java.net.ServerSocket;
-import java.net.SocketImpl;
-import java.net.SocketImplFactory;
-import java.net.SocketException;
-import java.nio.channels.SocketChannel;
-import java.nio.channels.ServerSocketChannel;
-import java.io.IOException;
-import java.io.FileDescriptor;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.InvocationTargetException;
-
-import sun.net.sdp.SdpSupport;
-
-/**
- * This class consists exclusively of static methods that Sockets or Channels to
- * sockets that support the InfiniBand Sockets Direct Protocol (SDP).
- */
-
-public final class Sdp {
- private Sdp() { }
-
- /**
- * The package-privage ServerSocket(SocketImpl) constructor
- */
- private static final Constructor<ServerSocket> serverSocketCtor;
- static {
- try {
- serverSocketCtor =
- ServerSocket.class.getDeclaredConstructor(SocketImpl.class);
- setAccessible(serverSocketCtor);
- } catch (NoSuchMethodException e) {
- throw new AssertionError(e);
- }
- }
-
- /**
- * The package-private SdpSocketImpl() constructor
- */
- private static final Constructor<SocketImpl> socketImplCtor;
- static {
- try {
- Class<?> cl = Class.forName("java.net.SdpSocketImpl", true, null);
- socketImplCtor = (Constructor<SocketImpl>)cl.getDeclaredConstructor();
- setAccessible(socketImplCtor);
- } catch (ClassNotFoundException e) {
- throw new AssertionError(e);
- } catch (NoSuchMethodException e) {
- throw new AssertionError(e);
- }
- }
-
- private static void setAccessible(final AccessibleObject o) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- o.setAccessible(true);
- return null;
- }
- });
- }
-
- /**
- * SDP enabled Socket.
- */
- private static class SdpSocket extends Socket {
- SdpSocket(SocketImpl impl) throws SocketException {
- super(impl);
- }
- }
-
- /**
- * Creates a SDP enabled SocketImpl
- */
- private static SocketImpl createSocketImpl() {
- try {
- return socketImplCtor.newInstance();
- } catch (InstantiationException x) {
- throw new AssertionError(x);
- } catch (IllegalAccessException x) {
- throw new AssertionError(x);
- } catch (InvocationTargetException x) {
- throw new AssertionError(x);
- }
- }
-
- /**
- * Creates an unconnected and unbound SDP socket. The {@code Socket} is
- * associated with a {@link java.net.SocketImpl} of the system-default type.
- *
- * @return a new Socket
- *
- * @throws UnsupportedOperationException
- * If SDP is not supported
- * @throws IOException
- * If an I/O error occurs
- */
- public static Socket openSocket() throws IOException {
- SocketImpl impl = createSocketImpl();
- return new SdpSocket(impl);
- }
-
- /**
- * Creates an unbound SDP server socket. The {@code ServerSocket} is
- * associated with a {@link java.net.SocketImpl} of the system-default type.
- *
- * @return a new ServerSocket
- *
- * @throws UnsupportedOperationException
- * If SDP is not supported
- * @throws IOException
- * If an I/O error occurs
- */
- public static ServerSocket openServerSocket() throws IOException {
- // create ServerSocket via package-private constructor
- SocketImpl impl = createSocketImpl();
- try {
- return serverSocketCtor.newInstance(impl);
- } catch (IllegalAccessException x) {
- throw new AssertionError(x);
- } catch (InstantiationException x) {
- throw new AssertionError(x);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- if (cause instanceof IOException)
- throw (IOException)cause;
- if (cause instanceof RuntimeException)
- throw (RuntimeException)cause;
- throw new RuntimeException(x);
- }
- }
-
- /**
- * Opens a socket channel to a SDP socket.
- *
- * <p> The channel will be associated with the system-wide default
- * {@link java.nio.channels.spi.SelectorProvider SelectorProvider}.
- *
- * @return a new SocketChannel
- *
- * @throws UnsupportedOperationException
- * If SDP is not supported or not supported by the default selector
- * provider
- * @throws IOException
- * If an I/O error occurs.
- */
- public static SocketChannel openSocketChannel() throws IOException {
- FileDescriptor fd = SdpSupport.createSocket();
- return sun.nio.ch.Secrets.newSocketChannel(fd);
- }
-
- /**
- * Opens a socket channel to a SDP socket.
- *
- * <p> The channel will be associated with the system-wide default
- * {@link java.nio.channels.spi.SelectorProvider SelectorProvider}.
- *
- * @return a new ServerSocketChannel
- *
- * @throws UnsupportedOperationException
- * If SDP is not supported or not supported by the default selector
- * provider
- * @throws IOException
- * If an I/O error occurs
- */
- public static ServerSocketChannel openServerSocketChannel()
- throws IOException
- {
- FileDescriptor fd = SdpSupport.createSocket();
- return sun.nio.ch.Secrets.newServerSocketChannel(fd);
- }
-}
--- a/jdk/src/share/classes/java/net/SdpSocketImpl.java Mon Apr 07 08:09:55 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.net;
-
-import java.io.IOException;
-import java.io.FileDescriptor;
-
-import sun.net.sdp.SdpSupport;
-
-/**
- * SocketImpl that supports the SDP protocol
- */
-class SdpSocketImpl extends PlainSocketImpl {
- SdpSocketImpl() { }
-
- @Override
- protected void create(boolean stream) throws IOException {
- if (!stream)
- throw new UnsupportedOperationException("Must be a stream socket");
- fd = SdpSupport.createSocket();
- if (socket != null)
- socket.setCreated();
- if (serverSocket != null)
- serverSocket.setCreated();
- }
-}
--- a/jdk/test/TEST.groups Mon Apr 07 08:09:55 2014 +0200
+++ b/jdk/test/TEST.groups Mon Apr 07 13:16:17 2014 +0100
@@ -102,7 +102,6 @@
jdk_net = \
java/net \
com/sun/net/httpserver \
- com/oracle/net \
sun/net
jdk_time = \
--- a/jdk/test/com/oracle/net/Sanity.java Mon Apr 07 08:09:55 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import com.oracle.net.Sdp;
-
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.*;
-
-/**
- * Exercise com.oracle.net.Sdp with each IP address plumbed to InfiniBand
- * interfaces listed in a given file.
- */
-
-public class Sanity {
- public static void main(String[] args) throws Exception {
- // The file is a list of interfaces to test.
- Scanner s = new Scanner(new File(args[0]));
- try {
- while (s.hasNextLine()) {
- String link = s.nextLine();
- NetworkInterface ni = NetworkInterface.getByName(link);
- if (ni != null) {
- Enumeration<InetAddress> addrs = ni.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress addr = addrs.nextElement();
- System.out.format("Testing %s: %s\n", link, addr.getHostAddress());
- test(addr);
- }
- }
- }
- } finally {
- s.close();
- }
- }
-
- static void test(InetAddress addr) throws Exception {
- // Test SocketChannel and ServerSocketChannel
- ServerSocketChannel ssc = Sdp.openServerSocketChannel();
- try {
- ssc.socket().bind(new InetSocketAddress(addr, 0));
- int port = ssc.socket().getLocalPort();
-
- // SocketChannel.connect (implicit bind)
- SocketChannel client = Sdp.openSocketChannel();
- try {
- client.connect(new InetSocketAddress(addr, port));
- SocketChannel peer = ssc.accept();
- try {
- testConnection(Channels.newOutputStream(client),
- Channels.newInputStream(peer));
- } finally {
- peer.close();
- }
- } finally {
- client.close();
- }
-
- // SocketChannel.connect (explicit bind)
- client = Sdp.openSocketChannel();
- try {
- client.socket().bind(new InetSocketAddress(addr, 0));
- client.connect(new InetSocketAddress(addr, port));
- ssc.accept().close();
- } finally {
- client.close();
- }
- } finally {
- ssc.close();
- }
-
- // Test Socket and ServerSocket
- ServerSocket ss = Sdp.openServerSocket();
- try {
- ss.bind(new InetSocketAddress(addr, 0));
- int port = ss.getLocalPort();
-
- // Socket.connect (implicit bind)
- Socket s = Sdp.openSocket();
- try {
- s.connect(new InetSocketAddress(addr, port));
- Socket peer = ss.accept();
- try {
- testConnection(s.getOutputStream(), peer.getInputStream());
- } finally {
- peer.close();
- }
- } finally {
- s.close();
- }
-
- // Socket.connect (explicit bind)
- s = Sdp.openSocket();
- try {
- s.bind(new InetSocketAddress(addr, 0));
- s.connect(new InetSocketAddress(addr, port));
- ss.accept().close();
- } finally {
- s.close();
- }
- } finally {
- ss.close();
- }
- }
-
- static void testConnection(OutputStream out, InputStream in)
- throws IOException
- {
- byte[] msg = "hello".getBytes();
- out.write(msg);
-
- byte[] ba = new byte[100];
- int nread = 0;
- while (nread < msg.length) {
- int n = in.read(ba);
- if (n < 0)
- throw new IOException("EOF not expected!");
- nread += n;
- }
- }
-}
--- a/jdk/test/com/oracle/net/sanity.sh Mon Apr 07 08:09:55 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#
-# Copyright (c) 2010, 2012, 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.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 6965072
-# @summary Unit test for SDP support
-# @build Sanity
-# @run shell sanity.sh
-
-IB_LINKS=ib.links
-
-OS=`uname -s`
-case "$OS" in
- SunOS )
- /usr/sbin/dladm show-part -o LINK -p > ${IB_LINKS}
- if [ $? != 0 ]; then
- echo "Unable to get InfiniBand parition link information"
- exit 0
- fi
- ;;
- Linux )
- if [ ! -f /proc/net/sdp ]; then
- echo "InfiniBand SDP module not installed"
- exit 0
- fi
- egrep "^[ \t]+ib" /proc/net/dev|cut -d':' -f1|tr -d '\t ' > ${IB_LINKS}
- ;;
- * )
- echo "This test only runs on Solaris or Linux"
- exit 0
- ;;
-esac
-
-if [ -z "$TESTJAVA" ]; then
- JAVA=java
- TESTCLASSES=.
- TESTSRC=.
-else
- JAVA="${TESTJAVA}/bin/java"
-fi
-
-CLASSPATH=${TESTCLASSES}:${TESTSRC}
-export CLASSPATH
-
-# Run sanity test (IPv4-only for now)
-$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true Sanity ${IB_LINKS}