changeset in /hg/icedtea6: Complete sun.nio.ch fixes.

Andrew John Hughes gnu_andrew at member.fsf.org
Tue Feb 3 04:13:58 PST 2009


changeset f42c98fdd7f4 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=f42c98fdd7f4
description:
	Complete sun.nio.ch fixes.

	2009-01-19  Andrew John Hughes  <gnu_andrew at member.fsf.org>

		* generated/sun/nio/ch/SocketOptionRegistry.java:
		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java:
		Added (1.7 extensions).
		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions: Fix package.
		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java:
		Added (1.7 extensions).
		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaNetGetIndexAccess.java,
		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java:
		Added to provide access to package-private NetworkInterface.getIndex().
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java,
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java,
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java:
		Fixed imports.
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java: Added.
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java: Fixed imports.
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/OptionKey.java: Added.
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java,
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java,
		* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java: Fixed imports.
		* overlays/nio2/openjdk/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c,
		* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java: Added.
		* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java:
		Fixed imports.
		* overlays/nio2/openjdk/jdk/src/windows/classes/sun/nio/ch/DefaultSelectorProvider.java: Added.
		* patches/icedtea-nio2.patch: Add hook for SharedSecrets to NetworkInterface, extend
		sun.nio.ch.{Net,DatagramChannelImpl,SelectorProviderImpl} to handle 1.7 extensions.

diffstat:

21 files changed, 1487 insertions(+), 16 deletions(-)
ChangeLog                                                                                                     |   29 
generated/sun/nio/ch/SocketOptionRegistry.java                                                                |   83 +
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java      |  223 ++++
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions                |    2 
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java |  199 +++
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaNetGetIndexAccess.java             |   45 
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java                     |   16 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java               |    5 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java                     |    8 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java                                   |    3 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java                              |   44 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java                                           |    5 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/OptionKey.java                                         |   48 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java                                     |    4 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java             |   14 
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java                                        |    3 
overlays/nio2/openjdk/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c                               |  129 ++
overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java                         |   76 +
overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java              |    3 
overlays/nio2/openjdk/jdk/src/windows/classes/sun/nio/ch/DefaultSelectorProvider.java                         |   49 
patches/icedtea-nio2.patch                                                                                    |  515 +++++++++-

diffs (truncated from 1771 to 500 lines):

diff -r 585bc814cee8 -r f42c98fdd7f4 ChangeLog
--- a/ChangeLog	Thu Jan 15 02:32:49 2009 +0000
+++ b/ChangeLog	Mon Jan 19 14:23:34 2009 +0000
@@ -1,3 +1,32 @@ 2009-01-14  Andrew John Hughes  <gnu_and
+2009-01-19  Andrew John Hughes  <gnu_andrew at member.fsf.org>
+
+	* generated/sun/nio/ch/SocketOptionRegistry.java:
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java:
+	Added (1.7 extensions).
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions: Fix package.
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java:
+	Added (1.7 extensions).
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaNetGetIndexAccess.java,
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/SharedSecrets.java:
+	Added to provide access to package-private NetworkInterface.getIndex().
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java,
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java,
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/CompletedFuture.java:
+	Fixed imports.
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java: Added.
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/Invoker.java: Fixed imports.
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/OptionKey.java: Added.
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/PendingFuture.java,
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java,
+	* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/ThreadPool.java: Fixed imports.
+	* overlays/nio2/openjdk/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c,
+	* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java: Added.
+	* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java:
+	Fixed imports.
+	* overlays/nio2/openjdk/jdk/src/windows/classes/sun/nio/ch/DefaultSelectorProvider.java: Added.
+	* patches/icedtea-nio2.patch: Add hook for SharedSecrets to NetworkInterface, extend
+	sun.nio.ch.{Net,DatagramChannelImpl,SelectorProviderImpl} to handle 1.7 extensions.
+
 2009-01-14  Andrew John Hughes  <gnu_andrew at member.fsf.org>
 
 	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
diff -r 585bc814cee8 -r f42c98fdd7f4 generated/sun/nio/ch/SocketOptionRegistry.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/generated/sun/nio/ch/SocketOptionRegistry.java	Mon Jan 19 14:23:34 2009 +0000
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  
+package sun.nio.ch;                                                            
+import java.util.Map;                                                          
+import java.util.HashMap;                                                      
+import org.classpath.icedtea.java.net.ProtocolFamily;                                                
+import org.classpath.icedtea.java.net.StandardProtocolFamily;                                        
+import org.classpath.icedtea.java.net.SocketOption;                            
+import org.classpath.icedtea.java.net.StandardSocketOption;                    
+class SocketOptionRegistry {                                                   
+    private SocketOptionRegistry() { }                                         
+    private static class RegistryKey {                                         
+        private final SocketOption<?> name;                                    
+        private final ProtocolFamily family;                                   
+        RegistryKey(SocketOption<?> name, ProtocolFamily family) {                
+            this.name = name;                                                  
+            this.family = family;                                              
+        }                                                                      
+        public int hashCode() {                                                
+            return name.hashCode() + family.hashCode();                        
+        }                                                                      
+        public boolean equals(Object ob) {                                     
+            if (ob == null) return false;                                      
+            if (!(ob instanceof RegistryKey)) return false;                    
+            RegistryKey other = (RegistryKey)ob;                               
+            if (this.name != other.name) return false;                         
+            if (this.family != other.family) return false;                     
+            return true;                                                       
+        }                                                                      
+    }                                                                          
+    private static class LazyInitialization {                                  
+        static final Map<RegistryKey,OptionKey> options = options();           
+        private static Map<RegistryKey,OptionKey> options() {                  
+            Map<RegistryKey,OptionKey> map =                                   
+                new HashMap<RegistryKey,OptionKey>();                          
+            map.put(new RegistryKey(StandardSocketOption.SO_BROADCAST, Net.UNSPEC), new OptionKey(1, 6));
+            map.put(new RegistryKey(StandardSocketOption.SO_KEEPALIVE, Net.UNSPEC), new OptionKey(1, 9));
+            map.put(new RegistryKey(StandardSocketOption.SO_LINGER, Net.UNSPEC), new OptionKey(1, 13));
+            map.put(new RegistryKey(StandardSocketOption.SO_SNDBUF, Net.UNSPEC), new OptionKey(1, 7));
+            map.put(new RegistryKey(StandardSocketOption.SO_RCVBUF, Net.UNSPEC), new OptionKey(1, 8));
+            map.put(new RegistryKey(StandardSocketOption.SO_REUSEADDR, Net.UNSPEC), new OptionKey(1, 2));
+            map.put(new RegistryKey(StandardSocketOption.TCP_NODELAY, Net.UNSPEC), new OptionKey(6, 1));
+            map.put(new RegistryKey(StandardSocketOption.IP_TOS, StandardProtocolFamily.INET), new OptionKey(0, 1));
+            map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_IF, StandardProtocolFamily.INET), new OptionKey(0, 32));
+            map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_TTL, StandardProtocolFamily.INET), new OptionKey(0, 33));
+            map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_LOOP, StandardProtocolFamily.INET), new OptionKey(0, 34));
+            map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_IF, StandardProtocolFamily.INET6), new OptionKey(41, 17));
+            map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_TTL, StandardProtocolFamily.INET6), new OptionKey(41, 18));
+            map.put(new RegistryKey(StandardSocketOption.IP_MULTICAST_LOOP, StandardProtocolFamily.INET6), new OptionKey(41, 19));
+            map.put(new RegistryKey(ExtendedSocketOption.SO_OOBINLINE, Net.UNSPEC), new OptionKey(1, 10));
+            return map;                                                        
+        }                                                                      
+    }                                                                          
+    public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) { 
+        RegistryKey key = new RegistryKey(name, family);                       
+        return LazyInitialization.options.get(key);                            
+    }                                                                          
+}                                                                              
diff -r 585bc814cee8 -r f42c98fdd7f4 overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/DatagramChannel.java	Mon Jan 19 14:23:34 2009 +0000
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package org.classpath.icedtea.java.nio.channels;
+
+import java.io.IOException;
+import java.net.DatagramSocket;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+
+import org.classpath.icedtea.java.net.ProtocolFamily;
+import org.classpath.icedtea.java.net.SocketOption;
+
+import org.classpath.icedtea.java.nio.channels.spi.SelectorProvider;
+
+/**
+ * A selectable channel for datagram-oriented sockets.
+ *
+ * <p> {@note revised} A datagram channel is created by invoking one of the {@link #open open} methods
+ * of this class. It is not possible to create a channel for an arbitrary,
+ * pre-existing datagram socket. A newly-created datagram channel is open but not
+ * connected. A datagram channel need not be connected in order for the {@link #send
+ * send} and {@link #receive receive} methods to be used.  A datagram channel may be
+ * connected, by invoking its {@link #connect connect} method, in order to
+ * avoid the overhead of the security checks are otherwise performed as part of
+ * every send and receive operation.  A datagram channel must be connected in
+ * order to use the {@link #read(java.nio.ByteBuffer) read} and {@link
+ * #write(java.nio.ByteBuffer) write} methods, since those methods do not
+ * accept or return socket addresses.
+ *
+ * <p> Once connected, a datagram channel remains connected until it is
+ * disconnected or closed.  Whether or not a datagram channel is connected may
+ * be determined by invoking its {@link #isConnected isConnected} method.
+ *
+ * <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
+ * setOption} method. A datagram channel to an Internet Protocol socket supports
+ * the following options:
+ * <blockquote>
+ * <table border>
+ *   <tr>
+ *     <th>Option Name</th>
+ *     <th>Description</th>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
+ *     <td> The size of the socket send buffer </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
+ *     <td> The size of the socket receive buffer </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
+ *     <td> Re-use address </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#SO_BROADCAST SO_BROADCAST} </td>
+ *     <td> Allow transmission of broadcast datagrams </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#IP_TOS IP_TOS} </td>
+ *     <td> The Type of Service (ToS) octet in the Internet Protocol (IP) header </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#IP_MULTICAST_IF IP_MULTICAST_IF} </td>
+ *     <td> The network interface for Internet Protocol (IP) multicast datagrams </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#IP_MULTICAST_TTL
+ *       IP_MULTICAST_TTL} </td>
+ *     <td> The <em>time-to-live</em> for Internet Protocol (IP) multicast
+ *       datagrams </td>
+ *   </tr>
+ *   <tr>
+ *     <td> {@link java.net.StandardSocketOption#IP_MULTICAST_LOOP
+ *       IP_MULTICAST_LOOP} </td>
+ *     <td> Loopback for Internet Protocol (IP) multicast datagrams </td>
+ *   </tr>
+ * </table>
+ * </blockquote>
+ * Additional (implementation specific) options may also be supported.
+ *
+ * <p> Datagram channels are safe for use by multiple concurrent threads.  They
+ * support concurrent reading and writing, though at most one thread may be
+ * reading and at most one thread may be writing at any given time.  </p>
+ *
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ * @since 1.4
+ * @updated 1.7
+ */
+
+public abstract class DatagramChannel
+    extends java.nio.channels.DatagramChannel
+    implements MulticastChannel
+{
+
+    /**
+     * Initializes a new instance of this class.
+     */
+    protected DatagramChannel(SelectorProvider provider) {
+        super(provider);
+    }
+
+    /**
+     * Opens a datagram channel.
+     *
+     * <p> The new channel is created by invoking the {@link
+     * java.nio.channels.spi.SelectorProvider#openDatagramChannel()
+     * openDatagramChannel} method of the system-wide default {@link
+     * java.nio.channels.spi.SelectorProvider} object.  The channel will not be
+     * connected.  </p>
+     *
+     * @return  A new datagram channel
+     *
+     * @throws  IOException
+     *          If an I/O error occurs
+     */
+    public static DatagramChannel open() throws IOException {
+        return SelectorProvider.provider().openDatagramChannel();
+    }
+
+    /**
+     * Opens a datagram channel.
+     *
+     * <p> The {@code family} parameter is used to specify the {@link
+     * ProtocolFamily}. If the datagram channel is to be used for IP multicasing
+     * then this should correspond to the address type of the multicast groups
+     * that this channel will join.
+     *
+     * <p> The new channel is created by invoking the {@link
+     * java.nio.channels.spi.SelectorProvider#openDatagramChannel(ProtocolFamily)
+     * openDatagramChannel} method of the system-wide default {@link
+     * java.nio.channels.spi.SelectorProvider} object.  The channel will not be
+     * connected.
+     *
+     * @param   family
+     *          The protocol family
+     *
+     * @return  A new datagram channel
+     *
+     * @throws  UnsupportedOperationException
+     *          If the specified protocol family is not supported. For example,
+     *          suppose the parameter is specified as {@link
+     *          java.net.StandardProtocolFamily#INET6 StandardProtocolFamily.INET6}
+     *          but IPv6 is not enabled on the platform.
+     * @throws  IOException
+     *          If an I/O error occurs
+     *
+     * @since   1.7
+     */
+    public static DatagramChannel open(ProtocolFamily family) throws IOException {
+        return SelectorProvider.provider().openDatagramChannel(family);
+    }
+
+
+    // -- Socket-specific operations --
+
+    /**
+     * @throws  AlreadyBoundException               {@inheritDoc}
+     * @throws  UnsupportedAddressTypeException     {@inheritDoc}
+     * @throws  ClosedChannelException              {@inheritDoc}
+     * @throws  IOException                         {@inheritDoc}
+     * @throws  SecurityException
+     *          If a security manager has been installed and its {@link
+     *          SecurityManager#checkListen checkListen} method denies the
+     *          operation
+     *
+     * @since 1.7
+     */
+    public abstract DatagramChannel bind(SocketAddress local)
+        throws IOException;
+
+    /**
+     * @throws  IllegalArgumentException                {@inheritDoc}
+     * @throws  ClosedChannelException                  {@inheritDoc}
+     * @throws  IOException                             {@inheritDoc}
+     *
+     * @since 1.7
+     */
+    public abstract <T> DatagramChannel setOption(SocketOption<T> name, T value)
+        throws IOException;
+
+    /**
+     * {@note new}
+     * Returns the remote address to which this channel's socket is connected.
+     *
+     * @return  The remote address; {@code null} if the channel's socket is not
+     *          connected
+     *
+     * @throws  ClosedChannelException
+     *          If the channel is closed
+     * @throws  IOException
+     *          If an I/O error occurs
+     *
+     * @since 1.7
+     */
+    public abstract SocketAddress getRemoteAddress() throws IOException;
+
+}
diff -r 585bc814cee8 -r f42c98fdd7f4 overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions
--- a/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions	Thu Jan 15 02:32:49 2009 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/exceptions	Mon Jan 19 14:23:34 2009 +0000
@@ -25,7 +25,7 @@
 
 # Generated exception classes for java.nio.channels
 
-PACKAGE=java.nio.channels
+PACKAGE=org.classpath.icedtea.java.nio.channels
 # This year should only change if the generated source is modified.
 COPYRIGHT_YEARS=2000-2007
 SINCE=1.7
diff -r 585bc814cee8 -r f42c98fdd7f4 overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/spi/SelectorProvider.java	Mon Jan 19 14:23:34 2009 +0000
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package org.classpath.icedtea.java.nio.channels.spi;
+
+import java.io.IOException;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+import java.util.ServiceConfigurationError;
+
+import org.classpath.icedtea.java.net.ProtocolFamily;
+
+import org.classpath.icedtea.java.nio.channels.DatagramChannel;
+
+/**
+ * Service-provider class for selectors and selectable channels.
+ *
+ * <p> A selector provider is a concrete subclass of this class that has a
+ * zero-argument constructor and implements the abstract methods specified
+ * below.  A given invocation of the Java virtual machine maintains a single
+ * system-wide default provider instance, which is returned by the {@link
+ * #provider() provider} method.  The first invocation of that method will locate
+ * the default provider as specified below.
+ *
+ * <p> The system-wide default provider is used by the static <tt>open</tt>
+ * methods of the {@link java.nio.channels.DatagramChannel#open
+ * DatagramChannel}, {@link java.nio.channels.Pipe#open Pipe}, {@link
+ * java.nio.channels.Selector#open Selector}, {@link
+ * java.nio.channels.ServerSocketChannel#open ServerSocketChannel}, and {@link
+ * java.nio.channels.SocketChannel#open SocketChannel} classes.  It is also
+ * used by the {@link java.lang.System#inheritedChannel System.inheritedChannel()}
+ * method. A program may make use of a provider other than the default provider
+ * by instantiating that provider and then directly invoking the <tt>open</tt>
+ * methods defined in this class.
+ *
+ * <p> All of the methods in this class are safe for use by multiple concurrent
+ * threads.  </p>
+ *
+ *
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ * @since 1.4
+ */
+
+public abstract class SelectorProvider
+    extends java.nio.channels.spi.SelectorProvider {
+
+    private static final Object lock = new Object();
+    private static SelectorProvider provider = null;
+
+    /**
+     * Opens a datagram channel.  </p>
+     *
+     * @return  The new channel
+     */
+    public abstract DatagramChannel openDatagramChannel()
+        throws IOException;
+
+    /**
+     * {@note new}
+     * Opens a datagram channel.
+     *
+     * @param   family
+     *          The protocol family
+     *
+     * @return  A new datagram channel
+     *
+     * @throws  UnsupportedOperationException
+     *          If the specified protocol family is not supported
+     * @throws  IOException
+     *          If an I/O error occurs
+     *
+     * @since 1.7
+     */
+    public abstract DatagramChannel openDatagramChannel(ProtocolFamily family)
+        throws IOException;
+
+    /**
+     * Returns the system-wide default selector provider for this invocation of
+     * the Java virtual machine.
+     *
+     * <p> The first invocation of this method locates the default provider
+     * object as follows: </p>
+     *
+     * <ol>
+     *
+     *   <li><p> If the system property
+     *   <tt>java.nio.channels.spi.SelectorProvider</tt> is defined then it is
+     *   taken to be the fully-qualified name of a concrete provider class.
+     *   The class is loaded and instantiated; if this process fails then an
+     *   unspecified error is thrown.  </p></li>
+     *
+     *   <li><p> If a provider class has been installed in a jar file that is
+     *   visible to the system class loader, and that jar file contains a
+     *   provider-configuration file named
+     *   <tt>java.nio.channels.spi.SelectorProvider</tt> in the resource
+     *   directory <tt>META-INF/services</tt>, then the first class name
+     *   specified in that file is taken.  The class is loaded and
+     *   instantiated; if this process fails then an unspecified error is
+     *   thrown.  </p></li>
+     *
+     *   <li><p> Finally, if no provider has been specified by any of the above
+     *   means then the system-default provider class is instantiated and the
+     *   result is returned.  </p></li>
+     *
+     * </ol>
+     *



More information about the distro-pkg-dev mailing list