Merge
authorlana
Mon, 16 May 2011 18:19:34 -0700
changeset 9702 af3ed4dd2997
parent 9670 51a9096f6799 (current diff)
parent 9701 4608ed0204d2 (diff)
child 9704 915171a14a94
Merge
jdk/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java
jdk/src/share/classes/java/net/StandardSocketOption.java
jdk/src/share/classes/java/nio/charset/StandardCharset.java
jdk/src/share/classes/java/nio/file/StandardWatchEventKind.java
jdk/test/java/nio/charset/StandardCharset/Standard.java
--- a/jdk/make/com/sun/nio/sctp/FILES_java.gmk	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/make/com/sun/nio/sctp/FILES_java.gmk	Mon May 16 18:19:34 2011 -0700
@@ -38,7 +38,7 @@
 	com/sun/nio/sctp/SctpMultiChannel.java \
 	com/sun/nio/sctp/SctpServerChannel.java \
 	com/sun/nio/sctp/SctpSocketOption.java \
-	com/sun/nio/sctp/SctpStandardSocketOption.java \
+	com/sun/nio/sctp/SctpStandardSocketOptions.java \
 	com/sun/nio/sctp/SendFailedNotification.java \
 	com/sun/nio/sctp/ShutdownNotification.java \
 	\
--- a/jdk/make/java/management/mapfile-vers	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/make/java/management/mapfile-vers	Mon May 16 18:19:34 2011 -0700
@@ -49,6 +49,7 @@
 	    Java_sun_management_Flag_setStringValue;
 	    Java_sun_management_GarbageCollectorImpl_getCollectionCount;
 	    Java_sun_management_GarbageCollectorImpl_getCollectionTime;
+	    Java_sun_management_GarbageCollectorImpl_setNotificationEnabled;
 	    Java_sun_management_GcInfoBuilder_fillGcAttributeInfo;
 	    Java_sun_management_GcInfoBuilder_getLastGcInfo0;
 	    Java_sun_management_GcInfoBuilder_getNumGcExtAttributes;
--- a/jdk/make/java/nio/FILES_java.gmk	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/make/java/nio/FILES_java.gmk	Mon May 16 18:19:34 2011 -0700
@@ -71,7 +71,7 @@
 	java/nio/charset/CoderMalfunctionError.java \
 	java/nio/charset/CodingErrorAction.java \
 	java/nio/charset/MalformedInputException.java \
-	java/nio/charset/StandardCharset.java \
+	java/nio/charset/StandardCharsets.java \
 	java/nio/charset/UnmappableCharacterException.java \
 	\
 	java/nio/charset/spi/CharsetProvider.java \
@@ -116,7 +116,7 @@
 	java/nio/file/SimpleFileVisitor.java \
 	java/nio/file/StandardCopyOption.java \
 	java/nio/file/StandardOpenOption.java \
-	java/nio/file/StandardWatchEventKind.java \
+	java/nio/file/StandardWatchEventKinds.java \
 	java/nio/file/TempFileHelper.java \
 	java/nio/file/WatchEvent.java \
 	java/nio/file/WatchKey.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2011, 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.sun.management;
+
+import javax.management.Notification;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataView;
+import javax.management.openmbean.CompositeType;
+import java.util.Collection;
+import java.util.Collections;
+import sun.management.GarbageCollectionNotifInfoCompositeData;
+
+/**
+ * The information about a garbage collection
+ *
+ * <p>
+ * A garbage collection notification is emitted by {@link GarbageCollectorMXBean}
+ * when the Java virtual machine completes a garbage collection action
+ * The notification emitted will contain the garbage collection notification
+ * information about the status of the memory:
+ * <u1>
+ *   <li>The name of the garbage collector used perform the collection.</li>
+ *   <li>The action performed by the garbage collector.</li>
+ *   <li>The cause of the garbage collection action.</li>
+ *   <li>A {@link GcInfo} object containing some statistics about the GC cycle
+          (start time, end time) and the memory usage before and after
+          the GC cycle.</li>
+ * </u1>
+ *
+ * <p>
+ * A {@link CompositeData CompositeData} representing
+ * the {@code GarbageCollectionNotificationInfo} object
+ * is stored in the
+ * {@linkplain javax.management.Notification#setUserData userdata}
+ * of a {@linkplain javax.management.Notification notification}.
+ * The {@link #from from} method is provided to convert from
+ * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo}
+ * object. For example:
+ *
+ * <blockquote><pre>
+ *      Notification notif;
+ *
+ *      // receive the notification emitted by a GarbageCollectorMXBean and set to notif
+ *      ...
+ *
+ *      String notifType = notif.getType();
+ *      if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
+ *          // retrieve the garbage collection notification information
+ *          CompositeData cd = (CompositeData) notif.getUserData();
+ *          GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
+ *          ....
+ *      }
+ * </pre></blockquote>
+ *
+ * <p>
+ * The type of the notification emitted by a {@code GarbageCollectorMXBean} is:
+ * <ul>
+ *   <li>A {@linkplain #GARBAGE_COLLECTION_NOTIFICATION garbage collection notification}.
+ *       <br>Used by every notification emitted by the garbage collector, the details about
+ *             the notification are provided in the {@linkplain #getGcAction action} String
+ *       <p></li>
+ * </ul>
+ **/
+
+public class GarbageCollectionNotificationInfo implements  CompositeDataView {
+
+    private final String gcName;
+    private final String gcAction;
+    private final String gcCause;
+    private final GcInfo gcInfo;
+    private final CompositeData cdata;
+
+    /**
+     * Notification type denoting that
+     * the Java virtual machine has completed a garbage collection cycle.
+     * This notification is emitted by a {@link GarbageCollectorMXBean}.
+     * The value of this notification type is
+     * {@code com.sun.management.gc.notification}.
+     */
+    public static final String GARBAGE_COLLECTION_NOTIFICATION =
+        "com.sun.management.gc.notification";
+
+    /**
+     * Constructs a {@code GarbageCollectionNotificationInfo} object.
+     *
+     * @param gcName The name of the garbage collector used to perform the collection
+     * @param gcAction The name of the action performed by the garbage collector
+     * @param gcCause The cause the garbage collection action
+     * @param gcInfo  a GcInfo object providing statistics about the GC cycle
+     */
+    public GarbageCollectionNotificationInfo(String gcName,
+                                             String gcAction,
+                                             String gcCause,
+                                             GcInfo gcInfo)  {
+        if (gcName == null) {
+            throw new NullPointerException("Null gcName");
+        }
+        if (gcAction == null) {
+            throw new NullPointerException("Null gcAction");
+        }
+        if (gcCause == null) {
+            throw new NullPointerException("Null gcCause");
+        }
+        this.gcName = gcName;
+        this.gcAction = gcAction;
+        this.gcCause = gcCause;
+        this.gcInfo = gcInfo;
+        this.cdata = new GarbageCollectionNotifInfoCompositeData(this);
+    }
+
+    GarbageCollectionNotificationInfo(CompositeData cd) {
+        GarbageCollectionNotifInfoCompositeData.validateCompositeData(cd);
+
+        this.gcName = GarbageCollectionNotifInfoCompositeData.getGcName(cd);
+        this.gcAction = GarbageCollectionNotifInfoCompositeData.getGcAction(cd);
+        this.gcCause = GarbageCollectionNotifInfoCompositeData.getGcCause(cd);
+        this.gcInfo = GarbageCollectionNotifInfoCompositeData.getGcInfo(cd);
+        this.cdata = cd;
+    }
+
+    /**
+     * Returns the name of the garbage collector used to perform the collection
+     *
+     * @return the name of the garbage collector used to perform the collection
+     */
+    public String getGcName() {
+        return gcName;
+    }
+
+    /**
+     * Returns the action of the performed by the garbage collector
+     *
+     * @return the the action of the performed by the garbage collector
+     */
+    public String getGcAction() {
+        return gcAction;
+    }
+
+    /**
+     * Returns the cause  the garbage collection
+     *
+     * @return the the cause  the garbage collection
+     */
+    public String getGcCause() {
+        return gcCause;
+    }
+
+    /**
+     * Returns the GC information related to the last garbage collection
+     *
+     * @return the GC information related to the
+     * last garbage collection
+     */
+    public GcInfo getGcInfo() {
+        return gcInfo;
+    }
+
+    /**
+     * Returns a {@code GarbageCollectionNotificationInfo} object represented by the
+     * given {@code CompositeData}.
+     * The given {@code CompositeData} must contain
+     * the following attributes:
+     * <blockquote>
+     * <table border>
+     * <tr>
+     *   <th align=left>Attribute Name</th>
+     *   <th align=left>Type</th>
+     * </tr>
+     * <tr>
+     *   <td>gcName</td>
+     *   <td>{@code java.lang.String}</td>
+     * </tr>
+     * <tr>
+     *   <td>gcAction</td>
+     *   <td>{@code java.lang.String}</td>
+     * </tr>
+     * <tr>
+     *   <td>gcCause</td>
+     *   <td>{@code java.lang.String}</td>
+     * </tr>
+     * <tr>
+     *   <td>gcInfo</td>
+     *   <td>{@code javax.management.openmbean.CompositeData}</td>
+     * </tr>
+     * </table>
+     * </blockquote>
+     *
+     * @param cd {@code CompositeData} representing a
+     *           {@code GarbageCollectionNotificationInfo}
+     *
+     * @throws IllegalArgumentException if {@code cd} does not
+     *   represent a {@code GarbaageCollectionNotificationInfo} object.
+     *
+     * @return a {@code GarbageCollectionNotificationInfo} object represented
+     *         by {@code cd} if {@code cd} is not {@code null};
+     *         {@code null} otherwise.
+     */
+    public static GarbageCollectionNotificationInfo from(CompositeData cd) {
+        if (cd == null) {
+            return null;
+        }
+
+        if (cd instanceof GarbageCollectionNotifInfoCompositeData) {
+            return ((GarbageCollectionNotifInfoCompositeData) cd).getGarbageCollectionNotifInfo();
+        } else {
+            return new GarbageCollectionNotificationInfo(cd);
+        }
+    }
+
+    public CompositeData toCompositeData(CompositeType ct) {
+        return cdata;
+    }
+
+}
--- a/jdk/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Mon May 16 18:19:34 2011 -0700
@@ -179,7 +179,7 @@
      * completely received. For messages being sent {@code true} indicates that
      * the message is complete, {@code false} indicates that the message is not
      * complete. How the send channel interprets this value depends on the value
-     * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
+     * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
      * SCTP_EXPLICIT_COMPLETE} socket option.
      *
      * @return  {@code true} if, and only if, the message is complete
@@ -192,7 +192,7 @@
      * <P> For messages being sent {@code true} indicates that
      * the message is complete, {@code false} indicates that the message is not
      * complete. How the send channel interprets this value depends on the value
-     * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
+     * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
      * SCTP_EXPLICIT_COMPLETE} socket option.
      *
      * @param  complete
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -65,55 +65,55 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS
+ *     <td> {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
  *                                          SCTP_DISABLE_FRAGMENTS} </td>
  *     <td> Enables or disables message fragmentation </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
+ *     <td> {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
  *                                          SCTP_EXPLICIT_COMPLETE} </td>
  *     <td> Enables or disables explicit message completion </td>
  *   </tr>
  *    <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
+ *     <td> {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
  *                                          SCTP_FRAGMENT_INTERLEAVE} </td>
  *     <td> Controls how the presentation of messages occur for the message
  *          receiver </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
+ *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
  *                                          SCTP_INIT_MAXSTREAMS} </td>
  *     <td> The maximum number of streams requested by the local endpoint during
  *          association initialization </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} </td>
+ *     <td> {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} </td>
  *     <td> Enables or disable a Nagle-like algorithm </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR
+ *     <td> {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
  *                                          SCTP_PRIMARY_ADDR} </td>
  *     <td> Requests that the local SCTP stack use the given peer address as the
  *          association primary </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR
+ *     <td> {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
  *                                          SCTP_SET_PEER_PRIMARY_ADDR} </td>
  *     <td> Requests that the peer mark the enclosed address as the association
  *          primary </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SO_SNDBUF
+ *     <td> {@link SctpStandardSocketOptions#SO_SNDBUF
  *                                          SO_SNDBUF} </td>
  *     <td> The size of the socket send buffer </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SO_RCVBUF
+ *     <td> {@link SctpStandardSocketOptions#SO_RCVBUF
  *                                          SO_RCVBUF} </td>
  *     <td> The size of the socket receive buffer </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SO_LINGER
+ *     <td> {@link SctpStandardSocketOptions#SO_LINGER
  *                                          SO_LINGER} </td>
  *     <td> Linger on close if data is present (when configured in blocking mode
  *          only) </td>
@@ -449,7 +449,7 @@
      * <P> This is a convience method and is equivalent to evaluating the
      * following expression:
      * <blockquote><pre>
-     * setOption(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
+     * setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
      *  .connect(remote);
      * </pre></blockquote>
      *
@@ -651,7 +651,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see SctpStandardSocketOption
+     * @see SctpStandardSocketOptions
      */
     public abstract <T> T getOption(SctpSocketOption<T> name)
         throws IOException;
@@ -680,7 +680,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see SctpStandardSocketOption
+     * @see SctpStandardSocketOptions
      */
     public abstract <T> SctpChannel setOption(SctpSocketOption<T> name, T value)
         throws IOException;
@@ -731,7 +731,7 @@
      * MessageInfo} will return {@code false}, and more invocations of this
      * method will be necessary to completely consume the messgae. Only
      * one message at a time will be partially delivered in any stream. The
-     * socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
+     * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
      * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
      * messages occurs.
      *
@@ -804,7 +804,7 @@
      * and sufficient room becomes available, then the remaining bytes in the
      * given byte buffer are transmitted as a single message. Sending a message
      * is atomic unless explicit message completion {@link
-     * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
+     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
      * socket option is enabled on this channel's socket.
      *
      * <P> The message is transferred from the byte buffer as if by a regular
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -69,55 +69,55 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS
+ *     <td> {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
  *                                          SCTP_DISABLE_FRAGMENTS} </td>
  *     <td> Enables or disables message fragmentation </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
+ *     <td> {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
  *                                          SCTP_EXPLICIT_COMPLETE} </td>
  *     <td> Enables or disables explicit message completion </td>
  *   </tr>
  *    <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
+ *     <td> {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
  *                                          SCTP_FRAGMENT_INTERLEAVE} </td>
  *     <td> Controls how the presentation of messages occur for the message
  *          receiver </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
+ *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
  *                                          SCTP_INIT_MAXSTREAMS} </td>
  *     <td> The maximum number of streams requested by the local endpoint during
  *          association initialization </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} </td>
+ *     <td> {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} </td>
  *     <td> Enables or disable a Nagle-like algorithm </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR
+ *     <td> {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
  *                                          SCTP_PRIMARY_ADDR} </td>
  *     <td> Requests that the local SCTP stack use the given peer address as the
  *          association primary </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR
+ *     <td> {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
  *                                          SCTP_SET_PEER_PRIMARY_ADDR} </td>
  *     <td> Requests that the peer mark the enclosed address as the association
  *          primary </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SO_SNDBUF
+ *     <td> {@link SctpStandardSocketOptions#SO_SNDBUF
  *                                          SO_SNDBUF} </td>
  *     <td> The size of the socket send buffer </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SO_RCVBUF
+ *     <td> {@link SctpStandardSocketOptions#SO_RCVBUF
  *                                          SO_RCVBUF} </td>
  *     <td> The size of the socket receive buffer </td>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SO_LINGER
+ *     <td> {@link SctpStandardSocketOptions#SO_LINGER
  *                                          SO_LINGER} </td>
  *     <td> Linger on close if data is present (when configured in blocking mode
  *          only) </td>
@@ -450,7 +450,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see SctpStandardSocketOption
+     * @see SctpStandardSocketOptions
      */
     public abstract <T> T getOption(SctpSocketOption<T> name,
                                     Association association)
@@ -489,7 +489,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see SctpStandardSocketOption
+     * @see SctpStandardSocketOptions
      */
     public abstract <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
                                                    T value,
@@ -542,7 +542,7 @@
      * MessageInfo} will return {@code false}, and more invocations of this
      * method will be necessary to completely consume the messgae. Only
      * one message at a time will be partially delivered in any stream. The
-     * socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
+     * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
      * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
      * messages occurs.
      *
@@ -635,14 +635,14 @@
      * underlying output buffer, then the remaining bytes in the given byte
      * buffer are transmitted as a single message. Sending a message
      * is atomic unless explicit message completion {@link
-     * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
+     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
      * socket option is enabled on this channel's socket.
      *
      * <P> If this channel is in non-blocking mode, there is sufficient room
      * in the underlying output buffer, and an implicit association setup is
      * required, then the remaining bytes in the given byte buffer are
      * transmitted as a single message, subject to {@link
-     * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
+     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
      * If for any reason the message cannot
      * be delivered an {@link AssociationChangeNotification association
      * changed} notification is put on the SCTP stack with its {@code event} parameter set
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -53,7 +53,7 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
+ *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
  *                                          SCTP_INIT_MAXSTREAMS} </td>
  *     <td> The maximum number of streams requested by the local endpoint during
  *          association initialization </td>
@@ -360,7 +360,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see SctpStandardSocketOption
+     * @see SctpStandardSocketOptions
      */
     public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
 
@@ -388,7 +388,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see SctpStandardSocketOption
+     * @see SctpStandardSocketOptions
      */
     public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name,
                                                     T value)
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java	Mon May 16 18:19:34 2011 -0700
@@ -33,6 +33,6 @@
  *
  * @since 1.7
  *
- * @see SctpStandardSocketOption
+ * @see SctpStandardSocketOptions
  */
 public interface SctpSocketOption<T> extends SocketOption<T> { }
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java	Mon May 16 18:17:26 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,419 +0,0 @@
-/*
- * Copyright (c) 2009, 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.sun.nio.sctp;
-
-import java.net.SocketAddress;
-import sun.nio.ch.SctpStdSocketOption;
-
-/**
- * SCTP channels supports the socket options defined by this class
- * (as well as those listed in the particular channel class) and may support
- * additional Implementation specific socket options.
- *
- * @since 1.7
- */
-public class SctpStandardSocketOption {
-    private SctpStandardSocketOption() {}
-    /**
-     * Enables or disables message fragmentation.
-     *
-     * <P> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. If enabled no SCTP message
-     * fragmentation will be performed. Instead if a message being sent
-     * exceeds the current PMTU size, the message will NOT be sent and
-     * an error will be indicated to the user.
-     *
-     * <P> It is implementation specific whether or not this option is
-     * supported.
-     */
-    public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
-        SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
-        sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
-
-    /**
-     * Enables or disables explicit message completion.
-     *
-     * <p> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. When this option is enabled,
-     * the {@code send} method may be invoked multiple times to a send message.
-     * The {@code isComplete} parameter of the {@link MessageInfo} must only
-     * be set to {@code true} for the final send to indicate that the message is
-     * complete. If this option is disabled then each individual {@code send}
-     * invocation is considered complete.
-     *
-     * <P> The default value of the option is {@code false} indicating that the
-     * option is disabled. It is implementation specific whether or not this
-     * option is supported.
-     */
-    public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
-        SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
-        sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
-
-    /**
-     * Fragmented interleave controls how the presentation of messages occur
-     * for the message receiver. There are three levels of fragment interleave
-     * defined. Two of the levels effect {@link SctpChannel}, while
-     * {@link SctpMultiChannel} is effected by all three levels.
-     *
-     * <P> This option takes an {@code Integer} value. It can be set to a value
-     * of {@code 0}, {@code 1} or {@code 2}.
-     *
-     * <P> Setting the three levels provides the following receiver
-     * interactions:
-     *
-     * <P> {@code level 0} - Prevents the interleaving of any messages. This
-     * means that when a partial delivery begins, no other messages will be
-     * received except the message being partially delivered. If another message
-     * arrives on a different stream (or association) that could be delivered,
-     * it will be blocked waiting for the user to read all of the partially
-     * delivered message.
-     *
-     * <P> {@code level 1} - Allows interleaving of messages that are from
-     * different associations. For {@code SctpChannel}, level 0 and
-     * level 1 have the same meaning since an {@code SctpChannel} always
-     * receives messages from the same association. Note that setting an {@code
-     * SctpMultiChannel} to this level may cause multiple partial
-     * delivers from different associations but for any given association, only
-     * one message will be delivered until all parts of a message have been
-     * delivered. This means that one large message, being read with an
-     * association identification of "X", will block other messages from
-     * association "X" from being delivered.
-     *
-     * <P> {@code level 2} - Allows complete interleaving of messages. This
-     * level requires that the sender carefully observe not only the peer
-     * {@code Association} but also must pay careful attention to the stream
-     * number. With this option enabled a partially delivered message may begin
-     * being delivered for association "X" stream "Y" and the next subsequent
-     * receive may return a message from association "X" stream "Z". Note that
-     * no other messages would be delivered for association "X" stream "Y"
-     * until all of stream "Y"'s partially delivered message was read.
-     * Note that this option effects both channel types.  Also note that
-     * for an {@code SctpMultiChannel} not only may another streams
-     * message from the same association be delivered from the next receive,
-     * some other associations message may be delivered upon the next receive.
-     *
-     * <P> It is implementation specific whether or not this option is
-     * supported.
-     */
-    public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
-            new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
-                  Integer.class,
-                  sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
-
-    /**
-     * The maximum number of streams requested by the local endpoint during
-     * association initialization.
-     *
-     * <P> The value of this socket option is an {@link
-     * SctpStandardSocketOption.InitMaxStreams InitMaxStreams}, that represents
-     * the maximum number of inbound and outbound streams that an association
-     * on the channel is prepared to support.
-     *
-     * <P> For an {@link SctpChannel} this option may only be used to
-     * change the number of inbound/outbound streams prior to connecting.
-     *
-     * <P> For an {@link SctpMultiChannel} this option determines
-     * the maximum number of inbound/outbound streams new associations setup
-     * on the channel will be prepared to support.
-     *
-     * <P> For an {@link SctpServerChannel} this option determines the
-     * maximum number of inbound/outbound streams accepted sockets will
-     * negotiate with their connecting peer.
-     *
-     * <P> In all cases the value set by this option is used in the negotiation
-     * of new associations setup on the channel's socket and the actual
-     * maximum number of inbound/outbound streams that have been negotiated
-     * with the peer can be retrieved from the appropriate {@link
-     * Association}. The {@code Association} can be retrieved from the
-     * {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}
-     * {@link AssociationChangeNotification} belonging to that association.
-     *
-     * <p> This value is bounded by the actual implementation. In other
-     * words the user may be able to support more streams than the Operating
-     * System. In such a case, the Operating System limit may override the
-     * value requested by the user. The default value of 0 indicates to use
-     * the endpoints default value.
-     */
-    public static final SctpSocketOption
-        <SctpStandardSocketOption.InitMaxStreams> SCTP_INIT_MAXSTREAMS =
-        new SctpStdSocketOption<SctpStandardSocketOption.InitMaxStreams>(
-        "SCTP_INIT_MAXSTREAMS", SctpStandardSocketOption.InitMaxStreams.class);
-
-    /**
-     * Enables or disables a Nagle-like algorithm.
-     *
-     * <P> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. SCTP uses an algorithm like
-     * <em>The Nagle Algorithm</em> to coalesce short segments and
-     * improve network efficiency.
-     */
-    public static final SctpSocketOption<Boolean> SCTP_NODELAY =
-        new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
-        sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY);
-
-    /**
-     * Requests that the local SCTP stack use the given peer address as
-     * the association primary.
-     *
-     * <P> The value of this socket option is a {@code SocketAddress}
-     * that represents the peer address that the local SCTP stack should use as
-     * the association primary. The address must be one of the association
-     * peer's addresses.
-     *
-     * <P> An {@code SctpMultiChannel} can control more than one
-     * association, the association parameter must be given when setting or
-     * retrieving this option.
-     *
-     * <P> Since {@code SctpChannel} only controls one association,
-     * the association parameter is not required and this option can be
-     * set or queried directly.
-     */
-     public static final SctpSocketOption<SocketAddress> SCTP_PRIMARY_ADDR =
-             new SctpStdSocketOption<SocketAddress>
-             ("SCTP_PRIMARY_ADDR", SocketAddress.class);
-
-     /**
-     * Requests that the peer mark the enclosed address as the association
-     * primary.
-     *
-     * <P> The value of this socket option is a {@code SocketAddress}
-     * that represents the local address that the peer should use as its
-     * primary address. The given address must be one of the association's
-     * locally bound addresses.
-     *
-     * <P> An {@code SctpMultiChannel} can control more than one
-     * association, the association parameter must be given when setting or
-     * retrieving this option.
-     *
-     * <P> Since {@code SctpChannel} only controls one association,
-     * the association parameter is not required and this option can be
-     * queried directly.
-     *
-     * <P> Note, this is a set only option and cannot be retrieved by {@code
-     * getOption}. It is implementation specific whether or not this
-     * option is supported.
-     */
-    public static final SctpSocketOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR =
-            new SctpStdSocketOption<SocketAddress>
-            ("SCTP_SET_PEER_PRIMARY_ADDR", SocketAddress.class);
-
-    /**
-     * The size of the socket send buffer.
-     *
-     * <p> The value of this socket option is an {@code Integer} that is the
-     * size of the socket send buffer in bytes. The socket send buffer is an
-     * output buffer used by the networking implementation. It may need to be
-     * increased for high-volume connections. The value of the socket option is
-     * a <em>hint</em> to the implementation to size the buffer and the actual
-     * size may differ. The socket option can be queried to retrieve the actual
-     * size.
-     *
-     * <p> For {@code SctpChannel}, this controls the amount of data
-     * the SCTP stack may have waiting in internal buffers to be sent. This
-     * option therefore bounds the maximum size of data that can be sent in a
-     * single send call.
-     *
-     * <P> For {@code SctpMultiChannel}, the effect is the same as for {@code
-     * SctpChannel}, except that it applies to all associations. The option
-     * applies to each association's window size separately.
-     *
-     * <p> An implementation allows this socket option to be set before the
-     * socket is bound or connected. Whether an implementation allows the
-     * socket send buffer to be changed after the socket is bound is system
-     * dependent.
-     */
-    public static final SctpSocketOption<Integer> SO_SNDBUF =
-        new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
-        sun.nio.ch.SctpStdSocketOption.SO_SNDBUF);
-
-    /**
-     * The size of the socket receive buffer.
-     *
-     * <P> The value of this socket option is an {@code Integer} that is the
-     * size of the socket receive buffer in bytes. The socket receive buffer is
-     * an input buffer used by the networking implementation. It may need to be
-     * increased for high-volume connections or decreased to limit the possible
-     * backlog of incoming data. The value of the socket option is a
-     * <em>hint</em> to the implementation to size the buffer and the actual
-     * size may differ.
-     *
-     * <P> For {@code SctpChannel}, this controls the receiver window size.
-     *
-     * <P> For {@code SctpMultiChannel}, the meaning is implementation
-     * dependent. It might control the receive buffer for each association bound
-     * to the socket descriptor or it might control the receive buffer for the
-     * whole socket.
-     *
-     * <p> An implementation allows this socket option to be set before the
-     * socket is bound or connected. Whether an implementation allows the
-     * socket receive buffer to be changed after the socket is bound is system
-     * dependent.
-     */
-    public static final SctpSocketOption<Integer> SO_RCVBUF =
-        new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
-        sun.nio.ch.SctpStdSocketOption.SO_RCVBUF);
-
-    /**
-     * Linger on close if data is present.
-     *
-     * <p> The value of this socket option is an {@code Integer} that controls
-     * the action taken when unsent data is queued on the socket and a method
-     * to close the socket is invoked. If the value of the socket option is zero
-     * or greater, then it represents a timeout value, in seconds, known as the
-     * <em>linger interval</em>. The linger interval is the timeout for the
-     * {@code close} method to block while the operating system attempts to
-     * transmit the unsent data or it decides that it is unable to transmit the
-     * data. If the value of the socket option is less than zero then the option
-     * is disabled. In that case the {@code close} method does not wait until
-     * unsent data is transmitted; if possible the operating system will transmit
-     * any unsent data before the connection is closed.
-     *
-     * <p> This socket option is intended for use with sockets that are configured
-     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
-     * only. The behavior of the {@code close} method when this option is
-     * enabled on a non-blocking socket is not defined.
-     *
-     * <p> The initial value of this socket option is a negative value, meaning
-     * that the option is disabled. The option may be enabled, or the linger
-     * interval changed, at any time. The maximum value of the linger interval
-     * is system dependent. Setting the linger interval to a value that is
-     * greater than its maximum value causes the linger interval to be set to
-     * its maximum value.
-     */
-    public static final SctpSocketOption<Integer> SO_LINGER =
-        new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
-        sun.nio.ch.SctpStdSocketOption.SO_LINGER);
-
-    /**
-     * This class is used to set the maximum number of inbound/outbound streams
-     * used by the local endpoint during association initialization. An
-     * instance of this class is used to set the {@link
-     * SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS}
-     * socket option.
-     *
-     * @since 1.7
-     */
-    public static class InitMaxStreams {
-        private int maxInStreams;
-        private int maxOutStreams;
-
-        private InitMaxStreams(int maxInStreams, int maxOutStreams) {
-           this.maxInStreams = maxInStreams;
-           this.maxOutStreams = maxOutStreams;
-        }
-
-        /**
-         * Creates an InitMaxStreams instance.
-         *
-         * @param  maxInStreams
-         *         The maximum number of inbound streams, where
-         *         {@code 0 <= maxInStreams <= 65536}
-         *
-         * @param  maxOutStreams
-         *         The maximum number of outbound streams, where
-         *         {@code 0 <= maxOutStreams <= 65536}
-         *
-         * @return  An {@code InitMaxStreams} instance
-         *
-         * @throws  IllegalArgumentException
-         *          If an argument is outside of specified bounds
-         */
-        public static InitMaxStreams create
-              (int maxInStreams, int maxOutStreams) {
-            if (maxOutStreams < 0 || maxOutStreams > 65535)
-                throw new IllegalArgumentException(
-                      "Invalid maxOutStreams value");
-            if (maxInStreams < 0 || maxInStreams > 65535)
-                throw new IllegalArgumentException(
-                      "Invalid maxInStreams value");
-
-            return new InitMaxStreams(maxInStreams, maxOutStreams);
-        }
-
-        /**
-         * Returns the maximum number of inbound streams.
-         *
-         * @return  Maximum inbound streams
-         */
-        public int maxInStreams() {
-            return maxInStreams;
-        }
-
-        /**
-         * Returns the maximum number of outbound streams.
-         *
-         * @return  Maximum outbound streams
-         */
-        public int maxOutStreams() {
-            return maxOutStreams;
-        }
-
-        /**
-         * Returns a string representation of this init max streams, including
-         * the maximum in and out bound streams.
-         *
-         * @return  A string representation of this init max streams
-         */
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(super.toString()).append(" [");
-            sb.append("maxInStreams:").append(maxInStreams);
-            sb.append("maxOutStreams:").append(maxOutStreams).append("]");
-            return sb.toString();
-        }
-
-        /**
-         * Returns true if the specified object is another {@code InitMaxStreams}
-         * instance with the same number of in and out bound streams.
-         *
-         * @param  obj
-         *         The object to be compared with this init max streams
-         *
-         * @return  true if the specified object is another
-         *          {@code InitMaxStreams} instance with the same number of in
-         *          and out bound streams
-         */
-        @Override
-        public boolean equals(Object obj) {
-            if (obj != null && obj instanceof InitMaxStreams) {
-                InitMaxStreams that = (InitMaxStreams) obj;
-                if (this.maxInStreams == that.maxInStreams &&
-                    this.maxOutStreams == that.maxOutStreams)
-                    return true;
-            }
-            return false;
-        }
-
-        /**
-         * Returns a hash code value for this init max streams.
-         */
-        @Override
-        public int hashCode() {
-            int hash = 7 ^ maxInStreams ^ maxOutStreams;
-            return hash;
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 2009, 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.sun.nio.sctp;
+
+import java.net.SocketAddress;
+import sun.nio.ch.SctpStdSocketOption;
+
+/**
+ * SCTP channels supports the socket options defined by this class
+ * (as well as those listed in the particular channel class) and may support
+ * additional Implementation specific socket options.
+ *
+ * @since 1.7
+ */
+public class SctpStandardSocketOptions {
+    private SctpStandardSocketOptions() {}
+    /**
+     * Enables or disables message fragmentation.
+     *
+     * <P> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. If enabled no SCTP message
+     * fragmentation will be performed. Instead if a message being sent
+     * exceeds the current PMTU size, the message will NOT be sent and
+     * an error will be indicated to the user.
+     *
+     * <P> It is implementation specific whether or not this option is
+     * supported.
+     */
+    public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
+        SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
+        sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
+
+    /**
+     * Enables or disables explicit message completion.
+     *
+     * <p> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. When this option is enabled,
+     * the {@code send} method may be invoked multiple times to a send message.
+     * The {@code isComplete} parameter of the {@link MessageInfo} must only
+     * be set to {@code true} for the final send to indicate that the message is
+     * complete. If this option is disabled then each individual {@code send}
+     * invocation is considered complete.
+     *
+     * <P> The default value of the option is {@code false} indicating that the
+     * option is disabled. It is implementation specific whether or not this
+     * option is supported.
+     */
+    public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
+        SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
+        sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
+
+    /**
+     * Fragmented interleave controls how the presentation of messages occur
+     * for the message receiver. There are three levels of fragment interleave
+     * defined. Two of the levels effect {@link SctpChannel}, while
+     * {@link SctpMultiChannel} is effected by all three levels.
+     *
+     * <P> This option takes an {@code Integer} value. It can be set to a value
+     * of {@code 0}, {@code 1} or {@code 2}.
+     *
+     * <P> Setting the three levels provides the following receiver
+     * interactions:
+     *
+     * <P> {@code level 0} - Prevents the interleaving of any messages. This
+     * means that when a partial delivery begins, no other messages will be
+     * received except the message being partially delivered. If another message
+     * arrives on a different stream (or association) that could be delivered,
+     * it will be blocked waiting for the user to read all of the partially
+     * delivered message.
+     *
+     * <P> {@code level 1} - Allows interleaving of messages that are from
+     * different associations. For {@code SctpChannel}, level 0 and
+     * level 1 have the same meaning since an {@code SctpChannel} always
+     * receives messages from the same association. Note that setting an {@code
+     * SctpMultiChannel} to this level may cause multiple partial
+     * delivers from different associations but for any given association, only
+     * one message will be delivered until all parts of a message have been
+     * delivered. This means that one large message, being read with an
+     * association identification of "X", will block other messages from
+     * association "X" from being delivered.
+     *
+     * <P> {@code level 2} - Allows complete interleaving of messages. This
+     * level requires that the sender carefully observe not only the peer
+     * {@code Association} but also must pay careful attention to the stream
+     * number. With this option enabled a partially delivered message may begin
+     * being delivered for association "X" stream "Y" and the next subsequent
+     * receive may return a message from association "X" stream "Z". Note that
+     * no other messages would be delivered for association "X" stream "Y"
+     * until all of stream "Y"'s partially delivered message was read.
+     * Note that this option effects both channel types.  Also note that
+     * for an {@code SctpMultiChannel} not only may another streams
+     * message from the same association be delivered from the next receive,
+     * some other associations message may be delivered upon the next receive.
+     *
+     * <P> It is implementation specific whether or not this option is
+     * supported.
+     */
+    public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
+            new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
+                  Integer.class,
+                  sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
+
+    /**
+     * The maximum number of streams requested by the local endpoint during
+     * association initialization.
+     *
+     * <P> The value of this socket option is an {@link
+     * SctpStandardSocketOptions.InitMaxStreams InitMaxStreams}, that represents
+     * the maximum number of inbound and outbound streams that an association
+     * on the channel is prepared to support.
+     *
+     * <P> For an {@link SctpChannel} this option may only be used to
+     * change the number of inbound/outbound streams prior to connecting.
+     *
+     * <P> For an {@link SctpMultiChannel} this option determines
+     * the maximum number of inbound/outbound streams new associations setup
+     * on the channel will be prepared to support.
+     *
+     * <P> For an {@link SctpServerChannel} this option determines the
+     * maximum number of inbound/outbound streams accepted sockets will
+     * negotiate with their connecting peer.
+     *
+     * <P> In all cases the value set by this option is used in the negotiation
+     * of new associations setup on the channel's socket and the actual
+     * maximum number of inbound/outbound streams that have been negotiated
+     * with the peer can be retrieved from the appropriate {@link
+     * Association}. The {@code Association} can be retrieved from the
+     * {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}
+     * {@link AssociationChangeNotification} belonging to that association.
+     *
+     * <p> This value is bounded by the actual implementation. In other
+     * words the user may be able to support more streams than the Operating
+     * System. In such a case, the Operating System limit may override the
+     * value requested by the user. The default value of 0 indicates to use
+     * the endpoints default value.
+     */
+    public static final SctpSocketOption
+        <SctpStandardSocketOptions.InitMaxStreams> SCTP_INIT_MAXSTREAMS =
+        new SctpStdSocketOption<SctpStandardSocketOptions.InitMaxStreams>(
+        "SCTP_INIT_MAXSTREAMS", SctpStandardSocketOptions.InitMaxStreams.class);
+
+    /**
+     * Enables or disables a Nagle-like algorithm.
+     *
+     * <P> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. SCTP uses an algorithm like
+     * <em>The Nagle Algorithm</em> to coalesce short segments and
+     * improve network efficiency.
+     */
+    public static final SctpSocketOption<Boolean> SCTP_NODELAY =
+        new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
+        sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY);
+
+    /**
+     * Requests that the local SCTP stack use the given peer address as
+     * the association primary.
+     *
+     * <P> The value of this socket option is a {@code SocketAddress}
+     * that represents the peer address that the local SCTP stack should use as
+     * the association primary. The address must be one of the association
+     * peer's addresses.
+     *
+     * <P> An {@code SctpMultiChannel} can control more than one
+     * association, the association parameter must be given when setting or
+     * retrieving this option.
+     *
+     * <P> Since {@code SctpChannel} only controls one association,
+     * the association parameter is not required and this option can be
+     * set or queried directly.
+     */
+     public static final SctpSocketOption<SocketAddress> SCTP_PRIMARY_ADDR =
+             new SctpStdSocketOption<SocketAddress>
+             ("SCTP_PRIMARY_ADDR", SocketAddress.class);
+
+     /**
+     * Requests that the peer mark the enclosed address as the association
+     * primary.
+     *
+     * <P> The value of this socket option is a {@code SocketAddress}
+     * that represents the local address that the peer should use as its
+     * primary address. The given address must be one of the association's
+     * locally bound addresses.
+     *
+     * <P> An {@code SctpMultiChannel} can control more than one
+     * association, the association parameter must be given when setting or
+     * retrieving this option.
+     *
+     * <P> Since {@code SctpChannel} only controls one association,
+     * the association parameter is not required and this option can be
+     * queried directly.
+     *
+     * <P> Note, this is a set only option and cannot be retrieved by {@code
+     * getOption}. It is implementation specific whether or not this
+     * option is supported.
+     */
+    public static final SctpSocketOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR =
+            new SctpStdSocketOption<SocketAddress>
+            ("SCTP_SET_PEER_PRIMARY_ADDR", SocketAddress.class);
+
+    /**
+     * The size of the socket send buffer.
+     *
+     * <p> The value of this socket option is an {@code Integer} that is the
+     * size of the socket send buffer in bytes. The socket send buffer is an
+     * output buffer used by the networking implementation. It may need to be
+     * increased for high-volume connections. The value of the socket option is
+     * a <em>hint</em> to the implementation to size the buffer and the actual
+     * size may differ. The socket option can be queried to retrieve the actual
+     * size.
+     *
+     * <p> For {@code SctpChannel}, this controls the amount of data
+     * the SCTP stack may have waiting in internal buffers to be sent. This
+     * option therefore bounds the maximum size of data that can be sent in a
+     * single send call.
+     *
+     * <P> For {@code SctpMultiChannel}, the effect is the same as for {@code
+     * SctpChannel}, except that it applies to all associations. The option
+     * applies to each association's window size separately.
+     *
+     * <p> An implementation allows this socket option to be set before the
+     * socket is bound or connected. Whether an implementation allows the
+     * socket send buffer to be changed after the socket is bound is system
+     * dependent.
+     */
+    public static final SctpSocketOption<Integer> SO_SNDBUF =
+        new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
+        sun.nio.ch.SctpStdSocketOption.SO_SNDBUF);
+
+    /**
+     * The size of the socket receive buffer.
+     *
+     * <P> The value of this socket option is an {@code Integer} that is the
+     * size of the socket receive buffer in bytes. The socket receive buffer is
+     * an input buffer used by the networking implementation. It may need to be
+     * increased for high-volume connections or decreased to limit the possible
+     * backlog of incoming data. The value of the socket option is a
+     * <em>hint</em> to the implementation to size the buffer and the actual
+     * size may differ.
+     *
+     * <P> For {@code SctpChannel}, this controls the receiver window size.
+     *
+     * <P> For {@code SctpMultiChannel}, the meaning is implementation
+     * dependent. It might control the receive buffer for each association bound
+     * to the socket descriptor or it might control the receive buffer for the
+     * whole socket.
+     *
+     * <p> An implementation allows this socket option to be set before the
+     * socket is bound or connected. Whether an implementation allows the
+     * socket receive buffer to be changed after the socket is bound is system
+     * dependent.
+     */
+    public static final SctpSocketOption<Integer> SO_RCVBUF =
+        new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
+        sun.nio.ch.SctpStdSocketOption.SO_RCVBUF);
+
+    /**
+     * Linger on close if data is present.
+     *
+     * <p> The value of this socket option is an {@code Integer} that controls
+     * the action taken when unsent data is queued on the socket and a method
+     * to close the socket is invoked. If the value of the socket option is zero
+     * or greater, then it represents a timeout value, in seconds, known as the
+     * <em>linger interval</em>. The linger interval is the timeout for the
+     * {@code close} method to block while the operating system attempts to
+     * transmit the unsent data or it decides that it is unable to transmit the
+     * data. If the value of the socket option is less than zero then the option
+     * is disabled. In that case the {@code close} method does not wait until
+     * unsent data is transmitted; if possible the operating system will transmit
+     * any unsent data before the connection is closed.
+     *
+     * <p> This socket option is intended for use with sockets that are configured
+     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
+     * only. The behavior of the {@code close} method when this option is
+     * enabled on a non-blocking socket is not defined.
+     *
+     * <p> The initial value of this socket option is a negative value, meaning
+     * that the option is disabled. The option may be enabled, or the linger
+     * interval changed, at any time. The maximum value of the linger interval
+     * is system dependent. Setting the linger interval to a value that is
+     * greater than its maximum value causes the linger interval to be set to
+     * its maximum value.
+     */
+    public static final SctpSocketOption<Integer> SO_LINGER =
+        new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
+        sun.nio.ch.SctpStdSocketOption.SO_LINGER);
+
+    /**
+     * This class is used to set the maximum number of inbound/outbound streams
+     * used by the local endpoint during association initialization. An
+     * instance of this class is used to set the {@link
+     * SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS}
+     * socket option.
+     *
+     * @since 1.7
+     */
+    public static class InitMaxStreams {
+        private int maxInStreams;
+        private int maxOutStreams;
+
+        private InitMaxStreams(int maxInStreams, int maxOutStreams) {
+           this.maxInStreams = maxInStreams;
+           this.maxOutStreams = maxOutStreams;
+        }
+
+        /**
+         * Creates an InitMaxStreams instance.
+         *
+         * @param  maxInStreams
+         *         The maximum number of inbound streams, where
+         *         {@code 0 <= maxInStreams <= 65536}
+         *
+         * @param  maxOutStreams
+         *         The maximum number of outbound streams, where
+         *         {@code 0 <= maxOutStreams <= 65536}
+         *
+         * @return  An {@code InitMaxStreams} instance
+         *
+         * @throws  IllegalArgumentException
+         *          If an argument is outside of specified bounds
+         */
+        public static InitMaxStreams create
+              (int maxInStreams, int maxOutStreams) {
+            if (maxOutStreams < 0 || maxOutStreams > 65535)
+                throw new IllegalArgumentException(
+                      "Invalid maxOutStreams value");
+            if (maxInStreams < 0 || maxInStreams > 65535)
+                throw new IllegalArgumentException(
+                      "Invalid maxInStreams value");
+
+            return new InitMaxStreams(maxInStreams, maxOutStreams);
+        }
+
+        /**
+         * Returns the maximum number of inbound streams.
+         *
+         * @return  Maximum inbound streams
+         */
+        public int maxInStreams() {
+            return maxInStreams;
+        }
+
+        /**
+         * Returns the maximum number of outbound streams.
+         *
+         * @return  Maximum outbound streams
+         */
+        public int maxOutStreams() {
+            return maxOutStreams;
+        }
+
+        /**
+         * Returns a string representation of this init max streams, including
+         * the maximum in and out bound streams.
+         *
+         * @return  A string representation of this init max streams
+         */
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+            sb.append(super.toString()).append(" [");
+            sb.append("maxInStreams:").append(maxInStreams);
+            sb.append("maxOutStreams:").append(maxOutStreams).append("]");
+            return sb.toString();
+        }
+
+        /**
+         * Returns true if the specified object is another {@code InitMaxStreams}
+         * instance with the same number of in and out bound streams.
+         *
+         * @param  obj
+         *         The object to be compared with this init max streams
+         *
+         * @return  true if the specified object is another
+         *          {@code InitMaxStreams} instance with the same number of in
+         *          and out bound streams
+         */
+        @Override
+        public boolean equals(Object obj) {
+            if (obj != null && obj instanceof InitMaxStreams) {
+                InitMaxStreams that = (InitMaxStreams) obj;
+                if (this.maxInStreams == that.maxInStreams &&
+                    this.maxOutStreams == that.maxOutStreams)
+                    return true;
+            }
+            return false;
+        }
+
+        /**
+         * Returns a hash code value for this init max streams.
+         */
+        @Override
+        public int hashCode() {
+            int hash = 7 ^ maxInStreams ^ maxOutStreams;
+            return hash;
+        }
+    }
+}
--- a/jdk/src/share/classes/java/lang/SafeVarargs.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/lang/SafeVarargs.java	Mon May 16 18:19:34 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -32,7 +32,7 @@
  * constructor does not perform potentially unsafe operations on its
  * varargs parameter.  Applying this annotation to a method or
  * constructor suppresses unchecked warnings about a
- * <i>non-reifiable</i> variable-arity (vararg) type and suppresses
+ * <i>non-reifiable</i> variable arity (vararg) type and suppresses
  * unchecked warnings about parameterized array creation at call
  * sites.
  *
@@ -41,11 +41,10 @@
  * additional usage restrictions on this annotation type; it is a
  * compile-time error if a method or constructor declaration is
  * annotated with a {@code @SafeVarargs} annotation, and either:
-
  * <ul>
- * <li>  the declaration is a fixed-arity method or constructor
+ * <li>  the declaration is a fixed arity method or constructor
  *
- * <li> the declaration is a variable-arity method that is neither
+ * <li> the declaration is a variable arity method that is neither
  * {@code static} nor {@code final}.
  *
  * </ul>
@@ -55,15 +54,28 @@
  *
  * <ul>
  *
- * <li> The variable-arity parameter has a reifiable element type,
+ * <li> The variable arity parameter has a reifiable element type,
  * which includes primitive types, {@code Object}, and {@code String}.
  * (The unchecked warnings this annotation type suppresses already do
  * not occur for a reifiable element type.)
  *
  * <li> The body of the method or constructor declaration performs
  * potentially unsafe operations, such as an assignment to an element
- * of the variable-arity parameter's array that generates an unchecked
- * warning.
+ * of the variable arity parameter's array that generates an unchecked
+ * warning.  Some unsafe operations do not trigger an unchecked
+ * warning.  For example, the aliasing in
+ *
+ * <blockquote><pre>
+ * &#64;SafeVarargs // Not actually safe!
+ * static void m(List&lt;String&gt;... stringLists) {
+ *   Object[] array = stringLists;
+ *   List&lt;Integer&gt; tmpList = Arrays.asList(42);
+ *   array[0] = tmpList; // Semantically invalid, but compiles without warnings
+ *   String s = stringLists[0].get(0); // Oh no, ClassCastException at runtime!
+ * }
+ * </pre></blockquote>
+ *
+ * leads to a {@code ClassCastException} at runtime.
  *
  * <p>Future versions of the platform may mandate compiler errors for
  * such unsafe operations.
--- a/jdk/src/share/classes/java/lang/Throwable.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Mon May 16 18:19:34 2011 -0700
@@ -336,7 +336,10 @@
      * Disabling of suppression should only occur in exceptional
      * circumstances where special requirements exist, such as a
      * virtual machine reusing exception objects under low-memory
-     * situations.
+     * situations.  Circumstances where a given exception object is
+     * repeatedly caught and rethrown, such as to implement control
+     * flow between two sub-systems, is another situation where
+     * immutable throwable objects would be appropriate.
      *
      * @param  message the detail message.
      * @param cause the cause.  (A {@code null} value is permitted,
@@ -423,6 +426,18 @@
      * {@link #Throwable(String,Throwable)}, this method cannot be called
      * even once.
      *
+     * <p>An example of using this method on a legacy throwable type
+     * without other support for setting the cause is:
+     *
+     * <pre>
+     * try {
+     *     lowLevelOp();
+     * } catch (LowLevelException le) {
+     *     throw (HighLevelException)
+     *           new HighLevelException().initCause(le); // Legacy constructor
+     * }
+     * </pre>
+     *
      * @param  cause the cause (which is saved for later retrieval by the
      *         {@link #getCause()} method).  (A {@code null} value is
      *         permitted, and indicates that the cause is nonexistent or
@@ -788,7 +803,8 @@
      * this throwable is permitted to return a zero-length array from this
      * method.  Generally speaking, the array returned by this method will
      * contain one element for every frame that would be printed by
-     * {@code printStackTrace}.
+     * {@code printStackTrace}.  Writes to the returned array do not
+     * affect future calls to this method.
      *
      * @return an array of stack trace elements representing the stack trace
      *         pertaining to this throwable.
@@ -971,8 +987,8 @@
     /**
      * Appends the specified exception to the exceptions that were
      * suppressed in order to deliver this exception. This method is
-     * typically called (automatically and implicitly) by the {@code
-     * try}-with-resources statement.
+     * thread-safe and typically called (automatically and implicitly)
+     * by the {@code try}-with-resources statement.
      *
      * <p>The suppression behavior is enabled <em>unless</em> disabled
      * {@linkplain #Throwable(String, Throwable, boolean, boolean) via
@@ -1043,7 +1059,9 @@
      *
      * If no exceptions were suppressed or {@linkplain
      * #Throwable(String, Throwable, boolean, boolean) suppression is
-     * disabled}, an empty array is returned.
+     * disabled}, an empty array is returned.  This method is
+     * thread-safe.  Writes to the returned array do not affect future
+     * calls to this method.
      *
      * @return an array containing all of the exceptions that were
      *         suppressed to deliver this exception.
--- a/jdk/src/share/classes/java/net/SocketOption.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/net/SocketOption.java	Mon May 16 18:19:34 2011 -0700
@@ -38,7 +38,7 @@
  *
  * @since 1.7
  *
- * @see StandardSocketOption
+ * @see StandardSocketOptions
  */
 
 public interface SocketOption<T> {
--- a/jdk/src/share/classes/java/net/StandardSocketOption.java	Mon May 16 18:17:26 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2007, 2009, 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;
-
-/**
- * Defines the <em>standard</em> socket options.
- *
- * <p> The {@link SocketOption#name name} of each socket option defined by this
- * class is its field name.
- *
- * <p> In this release, the socket options defined here are used by {@link
- * java.nio.channels.NetworkChannel network} channels in the {@link
- * java.nio.channels channels} package.
- *
- * @since 1.7
- */
-
-public final class StandardSocketOption {
-    private StandardSocketOption() { }
-
-    // -- SOL_SOCKET --
-
-    /**
-     * Allow transmission of broadcast datagrams.
-     *
-     * <p> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. The option is specific to
-     * datagram-oriented sockets sending to {@link java.net.Inet4Address IPv4}
-     * broadcast addresses. When the socket option is enabled then the socket
-     * can be used to send <em>broadcast datagrams</em>.
-     *
-     * <p> The initial value of this socket option is {@code FALSE}. The socket
-     * option may be enabled or disabled at any time. Some operating systems may
-     * require that the Java virtual machine be started with implementation
-     * specific privileges to enable this option or send broadcast datagrams.
-     *
-     * @see <a href="http://www.ietf.org/rfc/rfc919.txt">RFC&nbsp;929:
-     * Broadcasting Internet Datagrams</a>
-     * @see DatagramSocket#setBroadcast
-     */
-    public static final SocketOption<Boolean> SO_BROADCAST =
-        new StdSocketOption<Boolean>("SO_BROADCAST", Boolean.class);
-
-    /**
-     * Keep connection alive.
-     *
-     * <p> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. When the {@code SO_KEEPALIVE}
-     * option is enabled the operating system may use a <em>keep-alive</em>
-     * mechanism to periodically probe the other end of a connection when the
-     * connection is otherwise idle. The exact semantics of the keep alive
-     * mechanism is system dependent and therefore unspecified.
-     *
-     * <p> The initial value of this socket option is {@code FALSE}. The socket
-     * option may be enabled or disabled at any time.
-     *
-     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122
-     * Requirements for Internet Hosts -- Communication Layers</a>
-     * @see Socket#setKeepAlive
-     */
-    public static final SocketOption<Boolean> SO_KEEPALIVE =
-        new StdSocketOption<Boolean>("SO_KEEPALIVE", Boolean.class);
-
-    /**
-     * The size of the socket send buffer.
-     *
-     * <p> The value of this socket option is an {@code Integer} that is the
-     * size of the socket send buffer in bytes. The socket send buffer is an
-     * output buffer used by the networking implementation. It may need to be
-     * increased for high-volume connections. The value of the socket option is
-     * a <em>hint</em> to the implementation to size the buffer and the actual
-     * size may differ. The socket option can be queried to retrieve the actual
-     * size.
-     *
-     * <p> For datagram-oriented sockets, the size of the send buffer may limit
-     * the size of the datagrams that may be sent by the socket. Whether
-     * datagrams larger than the buffer size are sent or discarded is system
-     * dependent.
-     *
-     * <p> The initial/default size of the socket send buffer and the range of
-     * allowable values is system dependent although a negative size is not
-     * allowed. An attempt to set the socket send buffer to larger than its
-     * maximum size causes it to be set to its maximum size.
-     *
-     * <p> An implementation allows this socket option to be set before the
-     * socket is bound or connected. Whether an implementation allows the
-     * socket send buffer to be changed after the socket is bound is system
-     * dependent.
-     *
-     * @see Socket#setSendBufferSize
-     */
-    public static final SocketOption<Integer> SO_SNDBUF =
-        new StdSocketOption<Integer>("SO_SNDBUF", Integer.class);
-
-
-    /**
-     * The size of the socket receive buffer.
-     *
-     * <p> The value of this socket option is an {@code Integer} that is the
-     * size of the socket receive buffer in bytes. The socket receive buffer is
-     * an input buffer used by the networking implementation. It may need to be
-     * increased for high-volume connections or decreased to limit the possible
-     * backlog of incoming data. The value of the socket option is a
-     * <em>hint</em> to the implementation to size the buffer and the actual
-     * size may differ.
-     *
-     * <p> For datagram-oriented sockets, the size of the receive buffer may
-     * limit the size of the datagrams that can be received. Whether datagrams
-     * larger than the buffer size can be received is system dependent.
-     * Increasing the socket receive buffer may be important for cases where
-     * datagrams arrive in bursts faster than they can be processed.
-     *
-     * <p> In the case of stream-oriented sockets and the TCP/IP protocol, the
-     * size of the socket receive buffer may be used when advertising the size
-     * of the TCP receive window to the remote peer.
-     *
-     * <p> The initial/default size of the socket receive buffer and the range
-     * of allowable values is system dependent although a negative size is not
-     * allowed. An attempt to set the socket receive buffer to larger than its
-     * maximum size causes it to be set to its maximum size.
-     *
-     * <p> An implementation allows this socket option to be set before the
-     * socket is bound or connected. Whether an implementation allows the
-     * socket receive buffer to be changed after the socket is bound is system
-     * dependent.
-     *
-     * @see <a href="http://www.ietf.org/rfc/rfc1323.txt">RFC&nbsp;1323: TCP
-     * Extensions for High Performance</a>
-     * @see Socket#setReceiveBufferSize
-     * @see ServerSocket#setReceiveBufferSize
-     */
-    public static final SocketOption<Integer> SO_RCVBUF =
-        new StdSocketOption<Integer>("SO_RCVBUF", Integer.class);
-
-    /**
-     * Re-use address.
-     *
-     * <p> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. The exact semantics of this
-     * socket option are socket type and system dependent.
-     *
-     * <p> In the case of stream-oriented sockets, this socket option will
-     * usually determine whether the socket can be bound to a socket address
-     * when a previous connection involving that socket address is in the
-     * <em>TIME_WAIT</em> state. On implementations where the semantics differ,
-     * and the socket option is not required to be enabled in order to bind the
-     * socket when a previous connection is in this state, then the
-     * implementation may choose to ignore this option.
-     *
-     * <p> For datagram-oriented sockets the socket option is used to allow
-     * multiple programs bind to the same address. This option should be enabled
-     * when the socket is to be used for Internet Protocol (IP) multicasting.
-     *
-     * <p> An implementation allows this socket option to be set before the
-     * socket is bound or connected. Changing the value of this socket option
-     * after the socket is bound has no effect. The default value of this
-     * socket option is system dependent.
-     *
-     * @see <a href="http://www.ietf.org/rfc/rfc793.txt">RFC&nbsp;793: Transmission
-     * Control Protocol</a>
-     * @see ServerSocket#setReuseAddress
-     */
-    public static final SocketOption<Boolean> SO_REUSEADDR =
-        new StdSocketOption<Boolean>("SO_REUSEADDR", Boolean.class);
-
-    /**
-     * Linger on close if data is present.
-     *
-     * <p> The value of this socket option is an {@code Integer} that controls
-     * the action taken when unsent data is queued on the socket and a method
-     * to close the socket is invoked. If the value of the socket option is zero
-     * or greater, then it represents a timeout value, in seconds, known as the
-     * <em>linger interval</em>. The linger interval is the timeout for the
-     * {@code close} method to block while the operating system attempts to
-     * transmit the unsent data or it decides that it is unable to transmit the
-     * data. If the value of the socket option is less than zero then the option
-     * is disabled. In that case the {@code close} method does not wait until
-     * unsent data is transmitted; if possible the operating system will transmit
-     * any unsent data before the connection is closed.
-     *
-     * <p> This socket option is intended for use with sockets that are configured
-     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
-     * only. The behavior of the {@code close} method when this option is
-     * enabled on a non-blocking socket is not defined.
-     *
-     * <p> The initial value of this socket option is a negative value, meaning
-     * that the option is disabled. The option may be enabled, or the linger
-     * interval changed, at any time. The maximum value of the linger interval
-     * is system dependent. Setting the linger interval to a value that is
-     * greater than its maximum value causes the linger interval to be set to
-     * its maximum value.
-     *
-     * @see Socket#setSoLinger
-     */
-    public static final SocketOption<Integer> SO_LINGER =
-        new StdSocketOption<Integer>("SO_LINGER", Integer.class);
-
-
-    // -- IPPROTO_IP --
-
-    /**
-     * The Type of Service (ToS) octet in the Internet Protocol (IP) header.
-     *
-     * <p> The value of this socket option is an {@code Integer} representing
-     * the value of the ToS octet in IP packets sent by sockets to an {@link
-     * StandardProtocolFamily#INET IPv4} socket. The interpretation of the ToS
-     * octet is network specific and is not defined by this class. Further
-     * information on the ToS octet can be found in <a
-     * href="http://www.ietf.org/rfc/rfc1349.txt">RFC&nbsp;1349</a> and <a
-     * href="http://www.ietf.org/rfc/rfc2474.txt">RFC&nbsp;2474</a>. The value
-     * of the socket option is a <em>hint</em>. An implementation may ignore the
-     * value, or ignore specific values.
-     *
-     * <p> The initial/default value of the TOS field in the ToS octet is
-     * implementation specific but will typically be {@code 0}. For
-     * datagram-oriented sockets the option may be configured at any time after
-     * the socket has been bound. The new value of the octet is used when sending
-     * subsequent datagrams. It is system dependent whether this option can be
-     * queried or changed prior to binding the socket.
-     *
-     * <p> The behavior of this socket option on a stream-oriented socket, or an
-     * {@link StandardProtocolFamily#INET6 IPv6} socket, is not defined in this
-     * release.
-     *
-     * @see DatagramSocket#setTrafficClass
-     */
-    public static final SocketOption<Integer> IP_TOS =
-        new StdSocketOption<Integer>("IP_TOS", Integer.class);
-
-    /**
-     * The network interface for Internet Protocol (IP) multicast datagrams.
-     *
-     * <p> The value of this socket option is a {@link NetworkInterface} that
-     * represents the outgoing interface for multicast datagrams sent by the
-     * datagram-oriented socket. For {@link StandardProtocolFamily#INET6 IPv6}
-     * sockets then it is system dependent whether setting this option also
-     * sets the outgoing interface for multlicast datagrams sent to IPv4
-     * addresses.
-     *
-     * <p> The initial/default value of this socket option may be {@code null}
-     * to indicate that outgoing interface will be selected by the operating
-     * system, typically based on the network routing tables. An implementation
-     * allows this socket option to be set after the socket is bound. Whether
-     * the socket option can be queried or changed prior to binding the socket
-     * is system dependent.
-     *
-     * @see java.nio.channels.MulticastChannel
-     * @see MulticastSocket#setInterface
-     */
-    public static final SocketOption<NetworkInterface> IP_MULTICAST_IF =
-        new StdSocketOption<NetworkInterface>("IP_MULTICAST_IF", NetworkInterface.class);
-
-    /**
-     * The <em>time-to-live</em> for Internet Protocol (IP) multicast datagrams.
-     *
-     * <p> The value of this socket option is an {@code Integer} in the range
-     * <tt>0&nbsp;<=&nbsp;value&nbsp;<=&nbsp;255</tt>. It is used to control
-     * the scope of multicast datagrams sent by the datagram-oriented socket.
-     * In the case of an {@link StandardProtocolFamily#INET IPv4} socket
-     * the option is the time-to-live (TTL) on multicast datagrams sent by the
-     * socket. Datagrams with a TTL of zero are not transmitted on the network
-     * but may be delivered locally. In the case of an {@link
-     * StandardProtocolFamily#INET6 IPv6} socket the option is the
-     * <em>hop limit</em> which is number of <em>hops</em> that the datagram can
-     * pass through before expiring on the network. For IPv6 sockets it is
-     * system dependent whether the option also sets the <em>time-to-live</em>
-     * on multicast datagrams sent to IPv4 addresses.
-     *
-     * <p> The initial/default value of the time-to-live setting is typically
-     * {@code 1}. An implementation allows this socket option to be set after
-     * the socket is bound. Whether the socket option can be queried or changed
-     * prior to binding the socket is system dependent.
-     *
-     * @see java.nio.channels.MulticastChannel
-     * @see MulticastSocket#setTimeToLive
-     */
-    public static final SocketOption<Integer> IP_MULTICAST_TTL =
-        new StdSocketOption<Integer>("IP_MULTICAST_TTL", Integer.class);
-
-    /**
-     * Loopback for Internet Protocol (IP) multicast datagrams.
-     *
-     * <p> The value of this socket option is a {@code Boolean} that controls
-     * the <em>loopback</em> of multicast datagrams. The value of the socket
-     * option represents if the option is enabled or disabled.
-     *
-     * <p> The exact semantics of this socket options are system dependent.
-     * In particular, it is system dependent whether the loopback applies to
-     * multicast datagrams sent from the socket or received by the socket.
-     * For {@link StandardProtocolFamily#INET6 IPv6} sockets then it is
-     * system dependent whether the option also applies to multicast datagrams
-     * sent to IPv4 addresses.
-     *
-     * <p> The initial/default value of this socket option is {@code TRUE}. An
-     * implementation allows this socket option to be set after the socket is
-     * bound. Whether the socket option can be queried or changed prior to
-     * binding the socket is system dependent.
-     *
-     * @see java.nio.channels.MulticastChannel
-     *  @see MulticastSocket#setLoopbackMode
-     */
-    public static final SocketOption<Boolean> IP_MULTICAST_LOOP =
-        new StdSocketOption<Boolean>("IP_MULTICAST_LOOP", Boolean.class);
-
-
-    // -- IPPROTO_TCP --
-
-    /**
-     * Disable the Nagle algorithm.
-     *
-     * <p> The value of this socket option is a {@code Boolean} that represents
-     * whether the option is enabled or disabled. The socket option is specific to
-     * stream-oriented sockets using the TCP/IP protocol. TCP/IP uses an algorithm
-     * known as <em>The Nagle Algorithm</em> to coalesce short segments and
-     * improve network efficiency.
-     *
-     * <p> The default value of this socket option is {@code FALSE}. The
-     * socket option should only be enabled in cases where it is known that the
-     * coalescing impacts performance. The socket option may be enabled at any
-     * time. In other words, the Nagle Algorithm can be disabled. Once the option
-     * is enabled, it is system dependent whether it can be subsequently
-     * disabled. If it cannot, then invoking the {@code setOption} method to
-     * disable the option has no effect.
-     *
-     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122:
-     * Requirements for Internet Hosts -- Communication Layers</a>
-     * @see Socket#setTcpNoDelay
-     */
-    public static final SocketOption<Boolean> TCP_NODELAY =
-        new StdSocketOption<Boolean>("TCP_NODELAY", Boolean.class);
-
-
-    private static class StdSocketOption<T> implements SocketOption<T> {
-        private final String name;
-        private final Class<T> type;
-        StdSocketOption(String name, Class<T> type) {
-            this.name = name;
-            this.type = type;
-        }
-        @Override public String name() { return name; }
-        @Override public Class<T> type() { return type; }
-        @Override public String toString() { return name; }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/net/StandardSocketOptions.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2007, 2009, 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;
+
+/**
+ * Defines the <em>standard</em> socket options.
+ *
+ * <p> The {@link SocketOption#name name} of each socket option defined by this
+ * class is its field name.
+ *
+ * <p> In this release, the socket options defined here are used by {@link
+ * java.nio.channels.NetworkChannel network} channels in the {@link
+ * java.nio.channels channels} package.
+ *
+ * @since 1.7
+ */
+
+public final class StandardSocketOptions {
+    private StandardSocketOptions() { }
+
+    // -- SOL_SOCKET --
+
+    /**
+     * Allow transmission of broadcast datagrams.
+     *
+     * <p> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. The option is specific to
+     * datagram-oriented sockets sending to {@link java.net.Inet4Address IPv4}
+     * broadcast addresses. When the socket option is enabled then the socket
+     * can be used to send <em>broadcast datagrams</em>.
+     *
+     * <p> The initial value of this socket option is {@code FALSE}. The socket
+     * option may be enabled or disabled at any time. Some operating systems may
+     * require that the Java virtual machine be started with implementation
+     * specific privileges to enable this option or send broadcast datagrams.
+     *
+     * @see <a href="http://www.ietf.org/rfc/rfc919.txt">RFC&nbsp;929:
+     * Broadcasting Internet Datagrams</a>
+     * @see DatagramSocket#setBroadcast
+     */
+    public static final SocketOption<Boolean> SO_BROADCAST =
+        new StdSocketOption<Boolean>("SO_BROADCAST", Boolean.class);
+
+    /**
+     * Keep connection alive.
+     *
+     * <p> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. When the {@code SO_KEEPALIVE}
+     * option is enabled the operating system may use a <em>keep-alive</em>
+     * mechanism to periodically probe the other end of a connection when the
+     * connection is otherwise idle. The exact semantics of the keep alive
+     * mechanism is system dependent and therefore unspecified.
+     *
+     * <p> The initial value of this socket option is {@code FALSE}. The socket
+     * option may be enabled or disabled at any time.
+     *
+     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122
+     * Requirements for Internet Hosts -- Communication Layers</a>
+     * @see Socket#setKeepAlive
+     */
+    public static final SocketOption<Boolean> SO_KEEPALIVE =
+        new StdSocketOption<Boolean>("SO_KEEPALIVE", Boolean.class);
+
+    /**
+     * The size of the socket send buffer.
+     *
+     * <p> The value of this socket option is an {@code Integer} that is the
+     * size of the socket send buffer in bytes. The socket send buffer is an
+     * output buffer used by the networking implementation. It may need to be
+     * increased for high-volume connections. The value of the socket option is
+     * a <em>hint</em> to the implementation to size the buffer and the actual
+     * size may differ. The socket option can be queried to retrieve the actual
+     * size.
+     *
+     * <p> For datagram-oriented sockets, the size of the send buffer may limit
+     * the size of the datagrams that may be sent by the socket. Whether
+     * datagrams larger than the buffer size are sent or discarded is system
+     * dependent.
+     *
+     * <p> The initial/default size of the socket send buffer and the range of
+     * allowable values is system dependent although a negative size is not
+     * allowed. An attempt to set the socket send buffer to larger than its
+     * maximum size causes it to be set to its maximum size.
+     *
+     * <p> An implementation allows this socket option to be set before the
+     * socket is bound or connected. Whether an implementation allows the
+     * socket send buffer to be changed after the socket is bound is system
+     * dependent.
+     *
+     * @see Socket#setSendBufferSize
+     */
+    public static final SocketOption<Integer> SO_SNDBUF =
+        new StdSocketOption<Integer>("SO_SNDBUF", Integer.class);
+
+
+    /**
+     * The size of the socket receive buffer.
+     *
+     * <p> The value of this socket option is an {@code Integer} that is the
+     * size of the socket receive buffer in bytes. The socket receive buffer is
+     * an input buffer used by the networking implementation. It may need to be
+     * increased for high-volume connections or decreased to limit the possible
+     * backlog of incoming data. The value of the socket option is a
+     * <em>hint</em> to the implementation to size the buffer and the actual
+     * size may differ.
+     *
+     * <p> For datagram-oriented sockets, the size of the receive buffer may
+     * limit the size of the datagrams that can be received. Whether datagrams
+     * larger than the buffer size can be received is system dependent.
+     * Increasing the socket receive buffer may be important for cases where
+     * datagrams arrive in bursts faster than they can be processed.
+     *
+     * <p> In the case of stream-oriented sockets and the TCP/IP protocol, the
+     * size of the socket receive buffer may be used when advertising the size
+     * of the TCP receive window to the remote peer.
+     *
+     * <p> The initial/default size of the socket receive buffer and the range
+     * of allowable values is system dependent although a negative size is not
+     * allowed. An attempt to set the socket receive buffer to larger than its
+     * maximum size causes it to be set to its maximum size.
+     *
+     * <p> An implementation allows this socket option to be set before the
+     * socket is bound or connected. Whether an implementation allows the
+     * socket receive buffer to be changed after the socket is bound is system
+     * dependent.
+     *
+     * @see <a href="http://www.ietf.org/rfc/rfc1323.txt">RFC&nbsp;1323: TCP
+     * Extensions for High Performance</a>
+     * @see Socket#setReceiveBufferSize
+     * @see ServerSocket#setReceiveBufferSize
+     */
+    public static final SocketOption<Integer> SO_RCVBUF =
+        new StdSocketOption<Integer>("SO_RCVBUF", Integer.class);
+
+    /**
+     * Re-use address.
+     *
+     * <p> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. The exact semantics of this
+     * socket option are socket type and system dependent.
+     *
+     * <p> In the case of stream-oriented sockets, this socket option will
+     * usually determine whether the socket can be bound to a socket address
+     * when a previous connection involving that socket address is in the
+     * <em>TIME_WAIT</em> state. On implementations where the semantics differ,
+     * and the socket option is not required to be enabled in order to bind the
+     * socket when a previous connection is in this state, then the
+     * implementation may choose to ignore this option.
+     *
+     * <p> For datagram-oriented sockets the socket option is used to allow
+     * multiple programs bind to the same address. This option should be enabled
+     * when the socket is to be used for Internet Protocol (IP) multicasting.
+     *
+     * <p> An implementation allows this socket option to be set before the
+     * socket is bound or connected. Changing the value of this socket option
+     * after the socket is bound has no effect. The default value of this
+     * socket option is system dependent.
+     *
+     * @see <a href="http://www.ietf.org/rfc/rfc793.txt">RFC&nbsp;793: Transmission
+     * Control Protocol</a>
+     * @see ServerSocket#setReuseAddress
+     */
+    public static final SocketOption<Boolean> SO_REUSEADDR =
+        new StdSocketOption<Boolean>("SO_REUSEADDR", Boolean.class);
+
+    /**
+     * Linger on close if data is present.
+     *
+     * <p> The value of this socket option is an {@code Integer} that controls
+     * the action taken when unsent data is queued on the socket and a method
+     * to close the socket is invoked. If the value of the socket option is zero
+     * or greater, then it represents a timeout value, in seconds, known as the
+     * <em>linger interval</em>. The linger interval is the timeout for the
+     * {@code close} method to block while the operating system attempts to
+     * transmit the unsent data or it decides that it is unable to transmit the
+     * data. If the value of the socket option is less than zero then the option
+     * is disabled. In that case the {@code close} method does not wait until
+     * unsent data is transmitted; if possible the operating system will transmit
+     * any unsent data before the connection is closed.
+     *
+     * <p> This socket option is intended for use with sockets that are configured
+     * in {@link java.nio.channels.SelectableChannel#isBlocking() blocking} mode
+     * only. The behavior of the {@code close} method when this option is
+     * enabled on a non-blocking socket is not defined.
+     *
+     * <p> The initial value of this socket option is a negative value, meaning
+     * that the option is disabled. The option may be enabled, or the linger
+     * interval changed, at any time. The maximum value of the linger interval
+     * is system dependent. Setting the linger interval to a value that is
+     * greater than its maximum value causes the linger interval to be set to
+     * its maximum value.
+     *
+     * @see Socket#setSoLinger
+     */
+    public static final SocketOption<Integer> SO_LINGER =
+        new StdSocketOption<Integer>("SO_LINGER", Integer.class);
+
+
+    // -- IPPROTO_IP --
+
+    /**
+     * The Type of Service (ToS) octet in the Internet Protocol (IP) header.
+     *
+     * <p> The value of this socket option is an {@code Integer} representing
+     * the value of the ToS octet in IP packets sent by sockets to an {@link
+     * StandardProtocolFamily#INET IPv4} socket. The interpretation of the ToS
+     * octet is network specific and is not defined by this class. Further
+     * information on the ToS octet can be found in <a
+     * href="http://www.ietf.org/rfc/rfc1349.txt">RFC&nbsp;1349</a> and <a
+     * href="http://www.ietf.org/rfc/rfc2474.txt">RFC&nbsp;2474</a>. The value
+     * of the socket option is a <em>hint</em>. An implementation may ignore the
+     * value, or ignore specific values.
+     *
+     * <p> The initial/default value of the TOS field in the ToS octet is
+     * implementation specific but will typically be {@code 0}. For
+     * datagram-oriented sockets the option may be configured at any time after
+     * the socket has been bound. The new value of the octet is used when sending
+     * subsequent datagrams. It is system dependent whether this option can be
+     * queried or changed prior to binding the socket.
+     *
+     * <p> The behavior of this socket option on a stream-oriented socket, or an
+     * {@link StandardProtocolFamily#INET6 IPv6} socket, is not defined in this
+     * release.
+     *
+     * @see DatagramSocket#setTrafficClass
+     */
+    public static final SocketOption<Integer> IP_TOS =
+        new StdSocketOption<Integer>("IP_TOS", Integer.class);
+
+    /**
+     * The network interface for Internet Protocol (IP) multicast datagrams.
+     *
+     * <p> The value of this socket option is a {@link NetworkInterface} that
+     * represents the outgoing interface for multicast datagrams sent by the
+     * datagram-oriented socket. For {@link StandardProtocolFamily#INET6 IPv6}
+     * sockets then it is system dependent whether setting this option also
+     * sets the outgoing interface for multlicast datagrams sent to IPv4
+     * addresses.
+     *
+     * <p> The initial/default value of this socket option may be {@code null}
+     * to indicate that outgoing interface will be selected by the operating
+     * system, typically based on the network routing tables. An implementation
+     * allows this socket option to be set after the socket is bound. Whether
+     * the socket option can be queried or changed prior to binding the socket
+     * is system dependent.
+     *
+     * @see java.nio.channels.MulticastChannel
+     * @see MulticastSocket#setInterface
+     */
+    public static final SocketOption<NetworkInterface> IP_MULTICAST_IF =
+        new StdSocketOption<NetworkInterface>("IP_MULTICAST_IF", NetworkInterface.class);
+
+    /**
+     * The <em>time-to-live</em> for Internet Protocol (IP) multicast datagrams.
+     *
+     * <p> The value of this socket option is an {@code Integer} in the range
+     * <tt>0&nbsp;<=&nbsp;value&nbsp;<=&nbsp;255</tt>. It is used to control
+     * the scope of multicast datagrams sent by the datagram-oriented socket.
+     * In the case of an {@link StandardProtocolFamily#INET IPv4} socket
+     * the option is the time-to-live (TTL) on multicast datagrams sent by the
+     * socket. Datagrams with a TTL of zero are not transmitted on the network
+     * but may be delivered locally. In the case of an {@link
+     * StandardProtocolFamily#INET6 IPv6} socket the option is the
+     * <em>hop limit</em> which is number of <em>hops</em> that the datagram can
+     * pass through before expiring on the network. For IPv6 sockets it is
+     * system dependent whether the option also sets the <em>time-to-live</em>
+     * on multicast datagrams sent to IPv4 addresses.
+     *
+     * <p> The initial/default value of the time-to-live setting is typically
+     * {@code 1}. An implementation allows this socket option to be set after
+     * the socket is bound. Whether the socket option can be queried or changed
+     * prior to binding the socket is system dependent.
+     *
+     * @see java.nio.channels.MulticastChannel
+     * @see MulticastSocket#setTimeToLive
+     */
+    public static final SocketOption<Integer> IP_MULTICAST_TTL =
+        new StdSocketOption<Integer>("IP_MULTICAST_TTL", Integer.class);
+
+    /**
+     * Loopback for Internet Protocol (IP) multicast datagrams.
+     *
+     * <p> The value of this socket option is a {@code Boolean} that controls
+     * the <em>loopback</em> of multicast datagrams. The value of the socket
+     * option represents if the option is enabled or disabled.
+     *
+     * <p> The exact semantics of this socket options are system dependent.
+     * In particular, it is system dependent whether the loopback applies to
+     * multicast datagrams sent from the socket or received by the socket.
+     * For {@link StandardProtocolFamily#INET6 IPv6} sockets then it is
+     * system dependent whether the option also applies to multicast datagrams
+     * sent to IPv4 addresses.
+     *
+     * <p> The initial/default value of this socket option is {@code TRUE}. An
+     * implementation allows this socket option to be set after the socket is
+     * bound. Whether the socket option can be queried or changed prior to
+     * binding the socket is system dependent.
+     *
+     * @see java.nio.channels.MulticastChannel
+     *  @see MulticastSocket#setLoopbackMode
+     */
+    public static final SocketOption<Boolean> IP_MULTICAST_LOOP =
+        new StdSocketOption<Boolean>("IP_MULTICAST_LOOP", Boolean.class);
+
+
+    // -- IPPROTO_TCP --
+
+    /**
+     * Disable the Nagle algorithm.
+     *
+     * <p> The value of this socket option is a {@code Boolean} that represents
+     * whether the option is enabled or disabled. The socket option is specific to
+     * stream-oriented sockets using the TCP/IP protocol. TCP/IP uses an algorithm
+     * known as <em>The Nagle Algorithm</em> to coalesce short segments and
+     * improve network efficiency.
+     *
+     * <p> The default value of this socket option is {@code FALSE}. The
+     * socket option should only be enabled in cases where it is known that the
+     * coalescing impacts performance. The socket option may be enabled at any
+     * time. In other words, the Nagle Algorithm can be disabled. Once the option
+     * is enabled, it is system dependent whether it can be subsequently
+     * disabled. If it cannot, then invoking the {@code setOption} method to
+     * disable the option has no effect.
+     *
+     * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122:
+     * Requirements for Internet Hosts -- Communication Layers</a>
+     * @see Socket#setTcpNoDelay
+     */
+    public static final SocketOption<Boolean> TCP_NODELAY =
+        new StdSocketOption<Boolean>("TCP_NODELAY", Boolean.class);
+
+
+    private static class StdSocketOption<T> implements SocketOption<T> {
+        private final String name;
+        private final Class<T> type;
+        StdSocketOption(String name, Class<T> type) {
+            this.name = name;
+            this.type = type;
+        }
+        @Override public String name() { return name; }
+        @Override public Class<T> type() { return type; }
+        @Override public String toString() { return name; }
+    }
+}
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -58,11 +58,11 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
+ *     <td> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
  *     <td> Re-use address </td>
  *   </tr>
  * </table>
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -68,23 +68,23 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
+ *     <td> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
  *     <td> The size of the socket receive buffer </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} </td>
+ *     <td> {@link java.net.StandardSocketOptions#SO_KEEPALIVE SO_KEEPALIVE} </td>
  *     <td> Keep connection alive </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
+ *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
  *     <td> Re-use address </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} </td>
+ *     <td> {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} </td>
  *     <td> Disable the Nagle algorithm </td>
  *   </tr>
  * </table>
--- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -63,37 +63,37 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
+ *     <td> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
  *     <td> Re-use address </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_BROADCAST SO_BROADCAST} </td>
+ *     <td> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#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
+ *     <td> {@link java.net.StandardSocketOptions#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
+ *     <td> {@link java.net.StandardSocketOptions#IP_MULTICAST_LOOP
  *       IP_MULTICAST_LOOP} </td>
  *     <td> Loopback for Internet Protocol (IP) multicast datagrams </td>
  *   </tr>
--- a/jdk/src/share/classes/java/nio/channels/MulticastChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/MulticastChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -30,7 +30,7 @@
 import java.io.IOException;
 import java.net.ProtocolFamily;             // javadoc
 import java.net.StandardProtocolFamily;     // javadoc
-import java.net.StandardSocketOption;       // javadoc
+import java.net.StandardSocketOptions;      // javadoc
 
 /**
  * A network channel that supports Internet Protocol (IP) multicasting.
@@ -93,7 +93,7 @@
  * a specific address, rather than the wildcard address then it is implementation
  * specific if multicast datagrams are received by the socket. </p></li>
  *
- * <li><p> The {@link StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} option should be
+ * <li><p> The {@link StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} option should be
  * enabled prior to {@link NetworkChannel#bind binding} the socket. This is
  * required to allow multiple members of the group to bind to the same
  * address. </p></li>
@@ -107,9 +107,9 @@
  *     NetworkInterface ni = NetworkInterface.getByName("hme0");
  *
  *     DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET)
- *         .setOption(StandardSocketOption.SO_REUSEADDR, true)
+ *         .setOption(StandardSocketOptions.SO_REUSEADDR, true)
  *         .bind(new InetSocketAddress(5000))
- *         .setOption(StandardSocketOption.IP_MULTICAST_IF, ni);
+ *         .setOption(StandardSocketOptions.IP_MULTICAST_IF, ni);
  *
  *     InetAddress group = InetAddress.getByName("225.4.5.6");
  *
--- a/jdk/src/share/classes/java/nio/channels/NetworkChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/NetworkChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -124,7 +124,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see java.net.StandardSocketOption
+     * @see java.net.StandardSocketOptions
      */
     <T> NetworkChannel setOption(SocketOption<T> name, T value) throws IOException;
 
@@ -144,7 +144,7 @@
      * @throws  IOException
      *          If an I/O error occurs
      *
-     * @see java.net.StandardSocketOption
+     * @see java.net.StandardSocketOptions
      */
     <T> T getOption(SocketOption<T> name) throws IOException;
 
--- a/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -52,11 +52,11 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
+ *     <td> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
  *     <td> Re-use address </td>
  *   </tr>
  * </table>
--- a/jdk/src/share/classes/java/nio/channels/SocketChannel.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/channels/SocketChannel.java	Mon May 16 18:19:34 2011 -0700
@@ -72,28 +72,28 @@
  *     <th>Description</th>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
+ *     <td> {@link java.net.StandardSocketOptions#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> {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} </td>
  *     <td> The size of the socket receive buffer </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} </td>
+ *     <td> {@link java.net.StandardSocketOptions#SO_KEEPALIVE SO_KEEPALIVE} </td>
  *     <td> Keep connection alive </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
+ *     <td> {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} </td>
  *     <td> Re-use address </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#SO_LINGER SO_LINGER} </td>
+ *     <td> {@link java.net.StandardSocketOptions#SO_LINGER SO_LINGER} </td>
  *     <td> Linger on close if data is present (when configured in blocking mode
  *          only) </td>
  *   </tr>
  *   <tr>
- *     <td> {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} </td>
+ *     <td> {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} </td>
  *     <td> Disable the Nagle algorithm </td>
  *   </tr>
  * </table>
--- a/jdk/src/share/classes/java/nio/charset/Charset.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/charset/Charset.java	Mon May 16 18:19:34 2011 -0700
@@ -215,7 +215,7 @@
  * determined during virtual-machine startup and typically depends upon the
  * locale and charset being used by the underlying operating system. </p>
  *
- * <p>The {@link StandardCharset} class defines constants for each of the
+ * <p>The {@link StandardCharsets} class defines constants for each of the
  * standard charsets.
  *
  * <h4>Terminology</h4>
--- a/jdk/src/share/classes/java/nio/charset/StandardCharset.java	Mon May 16 18:17:26 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2011, 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.nio.charset;
-
-/**
- * Constant definitions for the standard {@link Charset Charsets}. These
- * charsets are guaranteed to be available on every implementation of the Java
- * platform.
- *
- * @see <a href="Charset#standard">Standard Charsets</a>
- * @since 1.7
- */
-public final class StandardCharset {
-
-    private StandardCharset() {
-        throw new AssertionError("No java.nio.charset.StandardCharset instances for you!");
-    }
-    /**
-     * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
-     * Unicode character set
-     */
-    public static final Charset US_ASCII = Charset.forName("US-ASCII");
-    /**
-     * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
-     */
-    public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
-    /**
-     * Eight-bit UCS Transformation Format
-     */
-    public static final Charset UTF_8 = Charset.forName("UTF-8");
-    /**
-     * Sixteen-bit UCS Transformation Format, big-endian byte order
-     */
-    public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
-    /**
-     * Sixteen-bit UCS Transformation Format, little-endian byte order
-     */
-    public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
-    /**
-     * Sixteen-bit UCS Transformation Format, byte order identified by an
-     * optional byte-order mark
-     */
-    public static final Charset UTF_16 = Charset.forName("UTF-16");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/nio/charset/StandardCharsets.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2011, 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.nio.charset;
+
+/**
+ * Constant definitions for the standard {@link Charset Charsets}. These
+ * charsets are guaranteed to be available on every implementation of the Java
+ * platform.
+ *
+ * @see <a href="Charset#standard">Standard Charsets</a>
+ * @since 1.7
+ */
+public final class StandardCharsets {
+
+    private StandardCharsets() {
+        throw new AssertionError("No java.nio.charset.StandardCharsets instances for you!");
+    }
+    /**
+     * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
+     * Unicode character set
+     */
+    public static final Charset US_ASCII = Charset.forName("US-ASCII");
+    /**
+     * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
+     */
+    public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
+    /**
+     * Eight-bit UCS Transformation Format
+     */
+    public static final Charset UTF_8 = Charset.forName("UTF-8");
+    /**
+     * Sixteen-bit UCS Transformation Format, big-endian byte order
+     */
+    public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
+    /**
+     * Sixteen-bit UCS Transformation Format, little-endian byte order
+     */
+    public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
+    /**
+     * Sixteen-bit UCS Transformation Format, byte order identified by an
+     * optional byte-order mark
+     */
+    public static final Charset UTF_16 = Charset.forName("UTF-16");
+}
--- a/jdk/src/share/classes/java/nio/file/Path.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/Path.java	Mon May 16 18:19:34 2011 -0700
@@ -72,7 +72,7 @@
  * directory and is UTF-8 encoded.
  * <pre>
  *     Path path = FileSystems.getDefault().getPath("logs", "access.log");
- *     BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
+ *     BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
  * </pre>
  *
  * <a name="interop"><h4>Interoperability</h4></a>
@@ -609,11 +609,11 @@
      * directory can be watched. The {@code events} parameter is the events to
      * register and may contain the following events:
      * <ul>
-     *   <li>{@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE} -
+     *   <li>{@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE} -
      *       entry created or moved into the directory</li>
-     *   <li>{@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE} -
+     *   <li>{@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE} -
      *        entry deleted or moved out of the directory</li>
-     *   <li>{@link StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} -
+     *   <li>{@link StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} -
      *        entry in directory was modified</li>
      * </ul>
      *
@@ -622,7 +622,7 @@
      * that locates the directory entry that is created, deleted, or modified.
      *
      * <p> The set of events may include additional implementation specific
-     * event that are not defined by the enum {@link StandardWatchEventKind}
+     * event that are not defined by the enum {@link StandardWatchEventKinds}
      *
      * <p> The {@code modifiers} parameter specifies <em>modifiers</em> that
      * qualify how the directory is registered. This release does not define any
--- a/jdk/src/share/classes/java/nio/file/StandardWatchEventKind.java	Mon May 16 18:17:26 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007, 2009, 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.nio.file;
-
-/**
- * Defines the <em>standard</em> event kinds.
- *
- * @since 1.7
- */
-
-public final class StandardWatchEventKind {
-    private StandardWatchEventKind() { }
-
-    /**
-     * A special event to indicate that events may have been lost or
-     * discarded.
-     *
-     * <p> The {@link WatchEvent#context context} for this event is
-     * implementation specific and may be {@code null}. The event {@link
-     * WatchEvent#count count} may be greater than {@code 1}.
-     *
-     * @see WatchService
-     */
-    public static final WatchEvent.Kind<Void> OVERFLOW =
-        new StdWatchEventKind<Void>("OVERFLOW", Void.class);
-
-    /**
-     * Directory entry created.
-     *
-     * <p> When a directory is registered for this event then the {@link WatchKey}
-     * is queued when it is observed that an entry is created in the directory
-     * or renamed into the directory. The event {@link WatchEvent#count count}
-     * for this event is always {@code 1}.
-     */
-    public static final WatchEvent.Kind<Path> ENTRY_CREATE =
-        new StdWatchEventKind<Path>("ENTRY_CREATE", Path.class);
-
-    /**
-     * Directory entry deleted.
-     *
-     * <p> When a directory is registered for this event then the {@link WatchKey}
-     * is queued when it is observed that an entry is deleted or renamed out of
-     * the directory. The event {@link WatchEvent#count count} for this event
-     * is always {@code 1}.
-     */
-    public static final WatchEvent.Kind<Path> ENTRY_DELETE =
-        new StdWatchEventKind<Path>("ENTRY_DELETE", Path.class);
-
-    /**
-     * Directory entry modified.
-     *
-     * <p> When a directory is registered for this event then the {@link WatchKey}
-     * is queued when it is observed that an entry in the directory has been
-     * modified. The event {@link WatchEvent#count count} for this event is
-     * {@code 1} or greater.
-     */
-    public static final WatchEvent.Kind<Path> ENTRY_MODIFY =
-        new StdWatchEventKind<Path>("ENTRY_MODIFY", Path.class);
-
-    private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {
-        private final String name;
-        private final Class<T> type;
-        StdWatchEventKind(String name, Class<T> type) {
-            this.name = name;
-            this.type = type;
-        }
-        @Override public String name() { return name; }
-        @Override public Class<T> type() { return type; }
-        @Override public String toString() { return name; }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/nio/file/StandardWatchEventKinds.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2007, 2009, 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.nio.file;
+
+/**
+ * Defines the <em>standard</em> event kinds.
+ *
+ * @since 1.7
+ */
+
+public final class StandardWatchEventKinds {
+    private StandardWatchEventKinds() { }
+
+    /**
+     * A special event to indicate that events may have been lost or
+     * discarded.
+     *
+     * <p> The {@link WatchEvent#context context} for this event is
+     * implementation specific and may be {@code null}. The event {@link
+     * WatchEvent#count count} may be greater than {@code 1}.
+     *
+     * @see WatchService
+     */
+    public static final WatchEvent.Kind<Object> OVERFLOW =
+        new StdWatchEventKind<Object>("OVERFLOW", Object.class);
+
+    /**
+     * Directory entry created.
+     *
+     * <p> When a directory is registered for this event then the {@link WatchKey}
+     * is queued when it is observed that an entry is created in the directory
+     * or renamed into the directory. The event {@link WatchEvent#count count}
+     * for this event is always {@code 1}.
+     */
+    public static final WatchEvent.Kind<Path> ENTRY_CREATE =
+        new StdWatchEventKind<Path>("ENTRY_CREATE", Path.class);
+
+    /**
+     * Directory entry deleted.
+     *
+     * <p> When a directory is registered for this event then the {@link WatchKey}
+     * is queued when it is observed that an entry is deleted or renamed out of
+     * the directory. The event {@link WatchEvent#count count} for this event
+     * is always {@code 1}.
+     */
+    public static final WatchEvent.Kind<Path> ENTRY_DELETE =
+        new StdWatchEventKind<Path>("ENTRY_DELETE", Path.class);
+
+    /**
+     * Directory entry modified.
+     *
+     * <p> When a directory is registered for this event then the {@link WatchKey}
+     * is queued when it is observed that an entry in the directory has been
+     * modified. The event {@link WatchEvent#count count} for this event is
+     * {@code 1} or greater.
+     */
+    public static final WatchEvent.Kind<Path> ENTRY_MODIFY =
+        new StdWatchEventKind<Path>("ENTRY_MODIFY", Path.class);
+
+    private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {
+        private final String name;
+        private final Class<T> type;
+        StdWatchEventKind(String name, Class<T> type) {
+            this.name = name;
+            this.type = type;
+        }
+        @Override public String name() { return name; }
+        @Override public Class<T> type() { return type; }
+        @Override public String toString() { return name; }
+    }
+}
--- a/jdk/src/share/classes/java/nio/file/WatchEvent.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/WatchEvent.java	Mon May 16 18:19:34 2011 -0700
@@ -50,7 +50,7 @@
      * An event kind, for the purposes of identification.
      *
      * @since 1.7
-     * @see StandardWatchEventKind
+     * @see StandardWatchEventKinds
      */
     public static interface Kind<T> {
         /**
@@ -98,9 +98,9 @@
     /**
      * Returns the context for the event.
      *
-     * <p> In the case of {@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE},
-     * {@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE}, and {@link
-     * StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} events the context is
+     * <p> In the case of {@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE},
+     * {@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE}, and {@link
+     * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} events the context is
      * a {@code Path} that is the {@link Path#relativize relative} path between
      * the directory registered with the watch service, and the entry that is
      * created, deleted, or modified.
--- a/jdk/src/share/classes/java/nio/file/WatchService.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/WatchService.java	Mon May 16 18:19:34 2011 -0700
@@ -68,7 +68,7 @@
  * of events that it may accumulate. Where an implementation <em>knowingly</em>
  * discards events then it arranges for the key's {@link WatchKey#pollEvents
  * pollEvents} method to return an element with an event type of {@link
- * StandardWatchEventKind#OVERFLOW OVERFLOW}. This event can be used by the
+ * StandardWatchEventKinds#OVERFLOW OVERFLOW}. This event can be used by the
  * consumer as a trigger to re-examine the state of the object.
  *
  * <p> When an event is reported to indicate that a file in a watched directory
@@ -87,7 +87,7 @@
  * are detected, their timeliness, and whether their ordering is preserved are
  * highly implementation specific. For example, when a file in a watched
  * directory is modified then it may result in a single {@link
- * StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} event in some
+ * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} event in some
  * implementations but several events in other implementations. Short-lived
  * files (meaning files that are deleted very quickly after they are created)
  * may not be detected by primitive implementations that periodically poll the
--- a/jdk/src/share/classes/java/nio/file/Watchable.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/Watchable.java	Mon May 16 18:19:34 2011 -0700
@@ -53,7 +53,7 @@
      * those specified by the {@code events} and {@code modifiers} parameters.
      * Changing the event set does not cause pending events for the object to be
      * discarded. Objects are automatically registered for the {@link
-     * StandardWatchEventKind#OVERFLOW OVERFLOW} event. This event is not
+     * StandardWatchEventKinds#OVERFLOW OVERFLOW} event. This event is not
      * required to be present in the array of events.
      *
      * <p> Otherwise the file system object has not yet been registered with the
--- a/jdk/src/share/classes/java/sql/BatchUpdateException.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/sql/BatchUpdateException.java	Mon May 16 18:19:34 2011 -0700
@@ -89,7 +89,7 @@
    * The <code>cause</code> is not initialized, and may subsequently be
    * initialized by a call to the
    * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
-   * is intialized to 0.
+   * is initialized to 0.
    * <p>
    *
    * @param reason a description of the exception
@@ -188,7 +188,7 @@
      * @since 1.6
      */
     public BatchUpdateException(Throwable cause) {
-        this(null, null, 0, null, cause);
+        this((cause == null ? null : cause.toString()), null, 0, null, cause);
     }
 
     /**
@@ -214,7 +214,7 @@
      * @since 1.6
      */
     public BatchUpdateException(int []updateCounts , Throwable cause) {
-        this(null, null, 0, updateCounts, cause);
+        this((cause == null ? null : cause.toString()), null, 0, updateCounts, cause);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/Formatter.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/Formatter.java	Mon May 16 18:19:34 2011 -0700
@@ -826,7 +826,7 @@
  *
  * <li> <a href="#dndec"><b>Float and Double</b></a>
  *
- * <li> <a href="#dndec"><b>BigDecimal</b></a>
+ * <li> <a href="#dnbdec"><b>BigDecimal</b></a>
  *
  * </ol>
  *
@@ -1362,7 +1362,7 @@
  * precision is not provided, then all of the digits as returned by {@link
  * Double#toHexString(double)} will be output.
  *
- * <p><a name="dndec"><b> BigDecimal </b></a>
+ * <p><a name="dnbdec"><b> BigDecimal </b></a>
  *
  * <p> The following conversions may be applied {@link java.math.BigDecimal
  * BigDecimal}.
@@ -1372,7 +1372,7 @@
  * <tr><td valign="top"> {@code 'e'}
  *     <td valign="top"> <tt>'&#92;u0065'</tt>
  *     <td> Requires the output to be formatted using <a
- *     name="scientific">computerized scientific notation</a>.  The <a
+ *     name="bscientific">computerized scientific notation</a>.  The <a
  *     href="#l10n algorithm">localization algorithm</a> is applied.
  *
  *     <p> The formatting of the magnitude <i>m</i> depends upon its value.
@@ -1427,11 +1427,11 @@
  *
  *     <p> If <i>m</i> is greater than or equal to 10<sup>-4</sup> but less
  *     than 10<sup>precision</sup> then it is represented in <i><a
- *     href="#decimal">decimal format</a></i>.
+ *     href="#bdecimal">decimal format</a></i>.
  *
  *     <p> If <i>m</i> is less than 10<sup>-4</sup> or greater than or equal to
  *     10<sup>precision</sup>, then it is represented in <i><a
- *     href="#scientific">computerized scientific notation</a></i>.
+ *     href="#bscientific">computerized scientific notation</a></i>.
  *
  *     <p> The total number of significant digits in <i>m</i> is equal to the
  *     precision.  If the precision is not specified, then the default value is
@@ -1447,7 +1447,7 @@
  *
  * <tr><td valign="top"> {@code 'f'}
  *     <td valign="top"> <tt>'&#92;u0066'</tt>
- *     <td> Requires the output to be formatted using <a name="decimal">decimal
+ *     <td> Requires the output to be formatted using <a name="bdecimal">decimal
  *     format</a>.  The <a href="#l10n algorithm">localization algorithm</a> is
  *     applied.
  *
--- a/jdk/src/share/classes/java/util/concurrent/Phaser.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Phaser.java	Mon May 16 18:19:34 2011 -0700
@@ -159,7 +159,7 @@
  * void runTasks(List<Runnable> tasks) {
  *   final Phaser phaser = new Phaser(1); // "1" to register self
  *   // create and start threads
- *   for (Runnable task : tasks) {
+ *   for (final Runnable task : tasks) {
  *     phaser.register();
  *     new Thread() {
  *       public void run() {
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon May 16 18:19:34 2011 -0700
@@ -275,10 +275,14 @@
      * snapshot -- the thread may have since unblocked or blocked on a
      * different blocker object.
      *
+     * @param t the thread
      * @return the blocker
+     * @throws NullPointerException if argument is null
      * @since 1.6
      */
     public static Object getBlocker(Thread t) {
+        if (t == null)
+            throw new NullPointerException();
         return unsafe.getObjectVolatile(t, parkBlockerOffset);
     }
 
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Mon May 16 18:19:34 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -342,12 +342,35 @@
     // already been created with the given name it is returned.
     // Otherwise a new logger instance is created and registered
     // in the LogManager global namespace.
+
+    // This method will always return a non-null Logger object.
+    // Synchronization is not required here. All synchronization for
+    // adding a new Logger object is handled by addLogger().
     Logger demandLogger(String name) {
         Logger result = getLogger(name);
         if (result == null) {
-            result = new Logger(name, null);
-            addLogger(result);
-            result = getLogger(name);
+            // only allocate the new logger once
+            Logger newLogger = new Logger(name, null);
+            do {
+                if (addLogger(newLogger)) {
+                    // We successfully added the new Logger that we
+                    // created above so return it without refetching.
+                    return newLogger;
+                }
+
+                // We didn't add the new Logger that we created above
+                // because another thread added a Logger with the same
+                // name after our null check above and before our call
+                // to addLogger(). We have to refetch the Logger because
+                // addLogger() returns a boolean instead of the Logger
+                // reference itself. However, if the thread that created
+                // the other Logger is not holding a strong reference to
+                // the other Logger, then it is possible for the other
+                // Logger to be GC'ed after we saw it in addLogger() and
+                // before we can refetch it. If it has been GC'ed then
+                // we'll just loop around and try again.
+                result = getLogger(name);
+            } while (result == null);
         }
         return result;
     }
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Mon May 16 18:19:34 2011 -0700
@@ -310,7 +310,20 @@
      * @return a suitable Logger
      * @throws NullPointerException if the name is null.
      */
-    public static synchronized Logger getLogger(String name) {
+
+    // Synchronization is not required here. All synchronization for
+    // adding a new Logger object is handled by LogManager.addLogger().
+    public static Logger getLogger(String name) {
+        // This method is intentionally not a wrapper around a call
+        // to getLogger(name, resourceBundleName). If it were then
+        // this sequence:
+        //
+        //     getLogger("Foo", "resourceBundleForFoo");
+        //     getLogger("Foo");
+        //
+        // would throw an IllegalArgumentException in the second call
+        // because the wrapper would result in an attempt to replace
+        // the existing "resourceBundleForFoo" with null.
         LogManager manager = LogManager.getLogManager();
         return manager.demandLogger(name);
     }
@@ -355,7 +368,10 @@
      *             a different resource bundle name.
      * @throws NullPointerException if the name is null.
      */
-    public static synchronized Logger getLogger(String name, String resourceBundleName) {
+
+    // Synchronization is not required here. All synchronization for
+    // adding a new Logger object is handled by LogManager.addLogger().
+    public static Logger getLogger(String name, String resourceBundleName) {
         LogManager manager = LogManager.getLogManager();
         Logger result = manager.demandLogger(name);
         if (result.resourceBundleName == null) {
@@ -417,7 +433,10 @@
      * @throws MissingResourceException if the resourceBundleName is non-null and
      *             no corresponding resource can be found.
      */
-    public static synchronized Logger getAnonymousLogger(String resourceBundleName) {
+
+    // Synchronization is not required here. All synchronization for
+    // adding a new anonymous Logger object is handled by doSetParent().
+    public static Logger getAnonymousLogger(String resourceBundleName) {
         LogManager manager = LogManager.getLogManager();
         // cleanup some Loggers that have been GC'ed
         manager.drainLoggerRefQueueBounded();
--- a/jdk/src/share/classes/java/util/regex/Pattern.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Mon May 16 18:19:34 2011 -0700
@@ -213,7 +213,7 @@
  *     <td headers="matches">A character in the Greek&nbsp;block (<a href="#ubc">block</a>)</td></tr>
  * <tr><td valign="top" headers="construct unicode"><tt>\p{Lu}</tt></td>
  *     <td headers="matches">An uppercase letter (<a href="#ucc">category</a>)</td></tr>
- * <tr><td valign="top" headers="construct unicode"><tt>\p{isAlphabetic}</tt></td>
+ * <tr><td valign="top" headers="construct unicode"><tt>\p{IsAlphabetic}</tt></td>
  *     <td headers="matches">An alphabetic character (<a href="#ubpc">binary property</a>)</td></tr>
  * <tr><td valign="top" headers="construct unicode"><tt>\p{Sc}</tt></td>
  *     <td headers="matches">A currency symbol</td></tr>
--- a/jdk/src/share/classes/java/util/zip/ZipCoder.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipCoder.java	Mon May 16 18:19:34 2011 -0700
@@ -28,7 +28,7 @@
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharset;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
@@ -107,7 +107,7 @@
         if (isUTF8)
             return getBytes(s);
         if (utf8 == null)
-            utf8 = new ZipCoder(StandardCharset.UTF_8);
+            utf8 = new ZipCoder(StandardCharsets.UTF_8);
         return utf8.getBytes(s);
     }
 
@@ -116,7 +116,7 @@
         if (isUTF8)
             return toString(ba, len);
         if (utf8 == null)
-            utf8 = new ZipCoder(StandardCharset.UTF_8);
+            utf8 = new ZipCoder(StandardCharsets.UTF_8);
         return utf8.toString(ba, len);
     }
 
@@ -132,7 +132,7 @@
 
     private ZipCoder(Charset cs) {
         this.cs = cs;
-        this.isUTF8 = cs.name().equals(StandardCharset.UTF_8.name());
+        this.isUTF8 = cs.name().equals(StandardCharsets.UTF_8.name());
     }
 
     static ZipCoder get(Charset charset) {
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java	Mon May 16 18:19:34 2011 -0700
@@ -31,7 +31,7 @@
 import java.io.EOFException;
 import java.io.File;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayDeque;
 import java.util.Deque;
 import java.util.Enumeration;
@@ -141,7 +141,7 @@
      * @since 1.3
      */
     public ZipFile(File file, int mode) throws IOException {
-        this(file, mode, StandardCharset.UTF_8);
+        this(file, mode, StandardCharsets.UTF_8);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/zip/ZipInputStream.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipInputStream.java	Mon May 16 18:19:34 2011 -0700
@@ -30,7 +30,7 @@
 import java.io.EOFException;
 import java.io.PushbackInputStream;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharset;
+import java.nio.charset.StandardCharsets;
 import static java.util.zip.ZipConstants64.*;
 
 /**
@@ -76,7 +76,7 @@
      * @param in the actual input stream
      */
     public ZipInputStream(InputStream in) {
-        this(in, StandardCharset.UTF_8);
+        this(in, StandardCharsets.UTF_8);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java	Mon May 16 18:19:34 2011 -0700
@@ -28,7 +28,7 @@
 import java.io.OutputStream;
 import java.io.IOException;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharset;
+import java.nio.charset.StandardCharsets;
 import java.util.Vector;
 import java.util.HashSet;
 import static java.util.zip.ZipConstants64.*;
@@ -101,7 +101,7 @@
      * @param out the actual output stream
      */
     public ZipOutputStream(OutputStream out) {
-        this(out, StandardCharset.UTF_8);
+        this(out, StandardCharsets.UTF_8);
     }
 
     /**
--- a/jdk/src/share/classes/javax/management/loading/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/loading/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
 <head>
 <title>javax.management.loading package</title>
 <!--
-Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1999, 2011, 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
@@ -68,7 +68,7 @@
 
     <p id="spec">
     @see <a href="{@docRoot}/../technotes/guides/jmx/">
-      Java SE 6 Platform documentation on JMX technology</a>,
+      Java Platform documentation on JMX technology</a>,
     in particular the 
     <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
       JMX Specification, version 1.4(pdf).</a>
--- a/jdk/src/share/classes/javax/management/modelmbean/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/modelmbean/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
 <head>
 <title>javax.management.modelmbean package</title>
 <!--
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2011, 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
@@ -116,7 +116,7 @@
 	  <li>See the <i>JMX 1.4 Specification</i>
 	     PDF document available from the 
 	     <a href="{@docRoot}/../technotes/guides/jmx/">
-	     Java SE 6 Platform documentation on JMX</a>
+	     Java Platform documentation on JMX technology</a>
     </ul>
 
     @since 1.5
--- a/jdk/src/share/classes/javax/management/monitor/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/monitor/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
 <head>
 <title>javax.management.monitor package</title>
 <!--
-Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1999, 2011, 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
@@ -184,7 +184,7 @@
       </ul>
     <p id="spec">
     @see <a href="{@docRoot}/../technotes/guides/jmx/">
-      Java SE 6 Platform documentation on JMX technology</a>,
+      Java Platform documentation on JMX technology</a>,
     in particular the 
     <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
       JMX Specification, version 1.4(pdf).</a>
--- a/jdk/src/share/classes/javax/management/openmbean/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/openmbean/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
 <head>
 <title>javax.management.openmbean package</title>
 <!--
-Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2001, 2011, 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
@@ -143,7 +143,7 @@
     </ul>
 
     @see <a href="{@docRoot}/../technotes/guides/jmx/">
-      Java SE 6 Platform documentation on JMX technology</a>,
+      Java Platform documentation on JMX technology</a>,
     in particular the 
     <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
       JMX Specification, version 1.4</a>
--- a/jdk/src/share/classes/javax/management/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
     <head>
         <title>javax.management package</title>
         <!--
-Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1999, 2011, 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
@@ -391,7 +391,7 @@
 
         <p id="spec">
         @see <a href="{@docRoot}/../technotes/guides/jmx/index.html">
-        Java SE 6 Platform documentation on JMX technology</a>
+        Java Platform documentation on JMX technology</a>
         in particular the
         <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
         JMX Specification, version 1.4(pdf).</a>
--- a/jdk/src/share/classes/javax/management/relation/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/relation/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
 <head>
 <title>javax.management.relation package</title>
 <!--
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2011, 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
@@ -137,7 +137,7 @@
 </pre>
 
     @see <a href="{@docRoot}/../technotes/guides/jmx/">
-      Java SE 6 Platform documentation on JMX technology</a>,
+      Java Platform documentation on JMX technology</a>,
     in particular the 
     <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
       JMX Specification, version 1.4</a>
--- a/jdk/src/share/classes/javax/management/remote/package.html	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/remote/package.html	Mon May 16 18:19:34 2011 -0700
@@ -2,7 +2,7 @@
 <head>
     <title>JMX<sup><font size="-2">TM</font></sup> Remote API.</title>
 <!--
-Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2002, 2011, 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
@@ -195,7 +195,7 @@
 
 
     @see <a href="{@docRoot}/../technotes/guides/jmx/">
-      Java SE 6 Platform documentation on JMX technology</a>,
+      Java Platform documentation on JMX technology</a>,
     in particular the 
     <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
       JMX Specification, version 1.4</a>
--- a/jdk/src/share/classes/javax/management/timer/Timer.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/javax/management/timer/Timer.java	Mon May 16 18:19:34 2011 -0700
@@ -26,6 +26,7 @@
 package javax.management.timer;
 
 import static com.sun.jmx.defaults.JmxProperties.TIMER_LOGGER;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -1003,7 +1004,10 @@
         Integer notifID;
         Date date;
 
-        for (Object[] obj : timerTable.values()) {
+        ArrayList<Object[]> values =
+            new ArrayList<Object[]>(timerTable.values());
+
+        for (Object[] obj : values) {
 
             // Retrieve the timer notification and the date notification.
             //
--- a/jdk/src/share/classes/sun/awt/FontDescriptor.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/awt/FontDescriptor.java	Mon May 16 18:19:34 2011 -0700
@@ -26,7 +26,7 @@
 
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
-import java.nio.charset.StandardCharset;
+import java.nio.charset.StandardCharsets;
 import sun.nio.cs.HistoricallyNamedCharset;
 
 public class FontDescriptor implements Cloneable {
@@ -105,8 +105,8 @@
         if (useUnicode && unicodeEncoder == null) {
             try {
                 this.unicodeEncoder = isLE?
-                    StandardCharset.UTF_16LE.newEncoder():
-                    StandardCharset.UTF_16BE.newEncoder();
+                    StandardCharsets.UTF_16LE.newEncoder():
+                    StandardCharsets.UTF_16BE.newEncoder();
             } catch (IllegalArgumentException x) {}
         }
         return useUnicode;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2011, 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 sun.management;
+
+import com.sun.management.GarbageCollectionNotificationInfo;
+import com.sun.management.GcInfo;
+import java.lang.reflect.Method;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+
+/**
+ * A CompositeData for GarbageCollectionNotificationInfo for the local management support.
+ * This class avoids the performance penalty paid to the
+ * construction of a CompositeData use in the local case.
+ */
+public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
+    private final GarbageCollectionNotificationInfo gcNotifInfo;
+
+    public GarbageCollectionNotifInfoCompositeData(GarbageCollectionNotificationInfo info) {
+        this.gcNotifInfo = info;
+    }
+
+    public GarbageCollectionNotificationInfo getGarbageCollectionNotifInfo() {
+        return gcNotifInfo;
+    }
+
+    public static CompositeData toCompositeData(GarbageCollectionNotificationInfo info) {
+        GarbageCollectionNotifInfoCompositeData gcnicd =
+            new GarbageCollectionNotifInfoCompositeData(info);
+        return gcnicd.getCompositeData();
+    }
+
+    private CompositeType getCompositeTypeByBuilder() {
+        final GcInfoBuilder builder = AccessController.doPrivileged (new PrivilegedAction<GcInfoBuilder>() {
+                public GcInfoBuilder run() {
+                    try {
+                        Class cl = Class.forName("com.sun.management.GcInfo");
+                        Field f = cl.getDeclaredField("builder");
+                        f.setAccessible(true);
+                        return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
+                    } catch(ClassNotFoundException e) {
+                        return null;
+                    } catch(NoSuchFieldException e) {
+                        return null;
+                    } catch(IllegalAccessException e) {
+                        return null;
+                    }
+                }
+            });
+        CompositeType gict = null;
+        synchronized(compositeTypeByBuilder) {
+            gict = compositeTypeByBuilder.get(builder);
+            if(gict == null) {
+                OpenType[] gcNotifInfoItemTypes = new OpenType[] {
+                    SimpleType.STRING,
+                    SimpleType.STRING,
+                    SimpleType.STRING,
+                    builder.getGcInfoCompositeType(),
+                };
+                try {
+                    final String typeName =
+                        "sun.management.GarbageCollectionNotifInfoCompositeType";
+                    gict = new CompositeType(typeName,
+                                             "CompositeType for GC notification info",
+                                             gcNotifInfoItemNames,
+                                             gcNotifInfoItemNames,
+                                             gcNotifInfoItemTypes);
+                    compositeTypeByBuilder.put(builder,gict);
+                } catch (OpenDataException e) {
+                    // shouldn't reach here
+                    throw Util.newException(e);
+                }
+            }
+        }
+        return gict;
+    }
+
+    protected CompositeData getCompositeData() {
+        // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
+        // gcNotifInfoItemNames!
+        final Object[] gcNotifInfoItemValues;
+        gcNotifInfoItemValues = new Object[] {
+            gcNotifInfo.getGcName(),
+            gcNotifInfo.getGcAction(),
+            gcNotifInfo.getGcCause(),
+            GcInfoCompositeData.toCompositeData(gcNotifInfo.getGcInfo())
+        };
+
+        CompositeType gict = getCompositeTypeByBuilder();
+
+        try {
+            return new CompositeDataSupport(gict,
+                                            gcNotifInfoItemNames,
+                                            gcNotifInfoItemValues);
+        } catch (OpenDataException e) {
+            // Should never reach here
+            throw new AssertionError(e);
+        }
+    }
+
+    //    private static MappedMXBeanType gcInfoMapType;
+    private static final String GC_NAME = "gcName";
+    private static final String GC_ACTION = "gcAction";
+    private static final String GC_CAUSE = "gcCause";
+    private static final String GC_INFO     = "gcInfo";
+    private static final String[] gcNotifInfoItemNames = {
+        GC_NAME,
+        GC_ACTION,
+        GC_CAUSE,
+        GC_INFO
+    };
+    private static HashMap<GcInfoBuilder,CompositeType> compositeTypeByBuilder =
+        new HashMap<GcInfoBuilder,CompositeType>();
+
+    public static String getGcName(CompositeData cd) {
+        String gcname = getString(cd, GC_NAME);
+        if (gcname == null) {
+            throw new IllegalArgumentException("Invalid composite data: " +
+                "Attribute " + GC_NAME + " has null value");
+        }
+        return gcname;
+    }
+
+    public static String getGcAction(CompositeData cd) {
+        String gcaction = getString(cd, GC_ACTION);
+        if (gcaction == null) {
+            throw new IllegalArgumentException("Invalid composite data: " +
+                "Attribute " + GC_ACTION + " has null value");
+        }
+        return gcaction;
+    }
+
+    public static String getGcCause(CompositeData cd) {
+        String gccause = getString(cd, GC_CAUSE);
+        if (gccause == null) {
+            throw new IllegalArgumentException("Invalid composite data: " +
+                "Attribute " + GC_CAUSE + " has null value");
+        }
+        return gccause;
+    }
+
+    public static GcInfo getGcInfo(CompositeData cd) {
+        CompositeData gcInfoData = (CompositeData) cd.get(GC_INFO);
+        return GcInfo.from(gcInfoData);
+    }
+
+    /** Validate if the input CompositeData has the expected
+     * CompositeType (i.e. contain all attributes with expected
+     * names and types).
+     */
+    public static void validateCompositeData(CompositeData cd) {
+        if (cd == null) {
+            throw new NullPointerException("Null CompositeData");
+        }
+
+        if (!isTypeMatched( getBaseGcNotifInfoCompositeType(), cd.getCompositeType())) {
+            throw new IllegalArgumentException(
+                "Unexpected composite type for GarbageCollectionNotificationInfo");
+        }
+    }
+
+    // This is only used for validation.
+    private static CompositeType baseGcNotifInfoCompositeType = null;
+    private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
+        if (baseGcNotifInfoCompositeType == null) {
+            try {
+                OpenType[] baseGcNotifInfoItemTypes = new OpenType[] {
+                    SimpleType.STRING,
+                    SimpleType.STRING,
+                    SimpleType.STRING,
+                    GcInfoCompositeData.getBaseGcInfoCompositeType()
+                };
+                baseGcNotifInfoCompositeType =
+                    new CompositeType("sun.management.BaseGarbageCollectionNotifInfoCompositeType",
+                                      "CompositeType for Base GarbageCollectionNotificationInfo",
+                                      gcNotifInfoItemNames,
+                                      gcNotifInfoItemNames,
+                                      baseGcNotifInfoItemTypes);
+            } catch (OpenDataException e) {
+                // shouldn't reach here
+                throw Util.newException(e);
+            }
+        }
+        return baseGcNotifInfoCompositeType;
+    }
+
+    private static final long serialVersionUID = -1805123446483771292L;
+}
--- a/jdk/src/share/classes/sun/management/GarbageCollectorImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/management/GarbageCollectorImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -26,6 +26,7 @@
 package sun.management;
 
 import com.sun.management.GarbageCollectorMXBean;
+import com.sun.management.GarbageCollectionNotificationInfo;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryPoolMXBean;
 import java.lang.management.MemoryUsage;
@@ -35,9 +36,15 @@
 import javax.management.MBeanInfo;
 import javax.management.MBeanAttributeInfo;
 import javax.management.ObjectName;
+import javax.management.MBeanNotificationInfo;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ListenerNotFoundException;
 
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Map;
 
 /**
  * Implementation class for the garbage collector.
@@ -78,19 +85,111 @@
 
     // Sun JDK extension
     private GcInfoBuilder gcInfoBuilder;
+
+    private synchronized GcInfoBuilder getGcInfoBuilder() {
+        if(gcInfoBuilder == null) {
+            gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames());
+        }
+        return gcInfoBuilder;
+    }
+
     public GcInfo getLastGcInfo() {
+        GcInfo info = getGcInfoBuilder().getLastGcInfo();
+        return info;
+    }
+
+    private final static String notifName =
+        "javax.management.Notification";
+
+    private final static String[] gcNotifTypes = {
+        GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION
+    };
+
+    private MBeanNotificationInfo[] notifInfo = null;
+    public MBeanNotificationInfo[] getNotificationInfo() {
         synchronized (this) {
-            if (gcInfoBuilder == null) {
-                 gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames());
+            if (notifInfo == null) {
+                 notifInfo = new MBeanNotificationInfo[1];
+                 notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes,
+                                                          notifName,
+                                                          "GC Notification");
             }
         }
+        return notifInfo;
+    }
 
-        GcInfo info = gcInfoBuilder.getLastGcInfo();
-        return info;
+    private static long seqNumber = 0;
+    private static long getNextSeqNumber() {
+        return ++seqNumber;
+    }
+
+    void createGCNotification(long timestamp,
+                              String gcName,
+                              String gcAction,
+                              String gcCause,
+                              GcInfo gcInfo)  {
+
+        if (!hasListeners()) {
+            return;
+        }
+
+        Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
+                                              getObjectName(),
+                                              getNextSeqNumber(),
+                                              timestamp,
+                                              gcName);
+        GarbageCollectionNotificationInfo info =
+            new GarbageCollectionNotificationInfo(gcName,
+                                                  gcAction,
+                                                  gcCause,
+                                                  gcInfo);
+
+        CompositeData cd =
+            GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
+        notif.setUserData(cd);
+        sendNotification(notif);
+    }
+
+    public synchronized void addNotificationListener(NotificationListener listener,
+                                                     NotificationFilter filter,
+                                                     Object handback)
+    {
+        boolean before = hasListeners();
+        super.addNotificationListener(listener, filter, handback);
+        boolean after = hasListeners();
+        if (!before && after) {
+            setNotificationEnabled(this, true);
+        }
+    }
+
+    public synchronized void removeNotificationListener(NotificationListener listener)
+        throws ListenerNotFoundException {
+        boolean before = hasListeners();
+        super.removeNotificationListener(listener);
+        boolean after = hasListeners();
+        if (before && !after) {
+            setNotificationEnabled(this,false);
+        }
+    }
+
+    public synchronized void removeNotificationListener(NotificationListener listener,
+                                                        NotificationFilter filter,
+                                                        Object handback)
+            throws ListenerNotFoundException
+    {
+        boolean before = hasListeners();
+        super.removeNotificationListener(listener,filter,handback);
+        boolean after = hasListeners();
+        if (before && !after) {
+            setNotificationEnabled(this,false);
+        }
     }
 
     public ObjectName getObjectName() {
         return Util.newObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE, getName());
     }
 
+    native void setNotificationEnabled(GarbageCollectorMXBean gc,
+                                       boolean enabled);
+
 }
--- a/jdk/src/share/classes/sun/management/GcInfoCompositeData.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/management/GcInfoCompositeData.java	Mon May 16 18:19:34 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -27,6 +27,7 @@
 
 import java.lang.management.MemoryUsage;
 import java.lang.reflect.Method;
+import java.lang.reflect.Field;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.HashMap;
@@ -41,6 +42,9 @@
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.OpenDataException;
 import com.sun.management.GcInfo;
+import com.sun.management.GarbageCollectionNotificationInfo;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  * A CompositeData for GcInfo for the local management support.
@@ -64,6 +68,44 @@
         return info;
     }
 
+    public static CompositeData toCompositeData(final GcInfo info) {
+        final GcInfoBuilder builder = AccessController.doPrivileged (new PrivilegedAction<GcInfoBuilder>() {
+                        public GcInfoBuilder run() {
+                            try {
+                                Class cl = Class.forName("com.sun.management.GcInfo");
+                                Field f = cl.getDeclaredField("builder");
+                                f.setAccessible(true);
+                                return (GcInfoBuilder)f.get(info);
+                            } catch(ClassNotFoundException e) {
+                                return null;
+                            } catch(NoSuchFieldException e) {
+                                return null;
+                            } catch(IllegalAccessException e) {
+                                return null;
+                            }
+                        }
+                    });
+        final Object[] extAttr = AccessController.doPrivileged (new PrivilegedAction<Object[]>() {
+                        public Object[] run() {
+                            try {
+                                Class cl = Class.forName("com.sun.management.GcInfo");
+                                Field f = cl.getDeclaredField("extAttributes");
+                                f.setAccessible(true);
+                                return (Object[])f.get(info);
+                            } catch(ClassNotFoundException e) {
+                                return null;
+                            } catch(NoSuchFieldException e) {
+                                return null;
+                            } catch(IllegalAccessException e) {
+                                return null;
+                            }
+                        }
+                    });
+        GcInfoCompositeData gcicd =
+            new GcInfoCompositeData(info,builder,extAttr);
+        return gcicd.getCompositeData();
+    }
+
     protected CompositeData getCompositeData() {
         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
         // baseGcInfoItemNames!
@@ -115,7 +157,6 @@
         }
     }
 
-
     private static final String ID                     = "id";
     private static final String START_TIME             = "startTime";
     private static final String END_TIME               = "endTime";
@@ -231,7 +272,7 @@
 
     // This is only used for validation.
     private static CompositeType baseGcInfoCompositeType = null;
-    private static synchronized CompositeType getBaseGcInfoCompositeType() {
+    static synchronized CompositeType getBaseGcInfoCompositeType() {
         if (baseGcInfoCompositeType == null) {
             try {
                 baseGcInfoCompositeType =
--- a/jdk/src/share/classes/sun/management/MemoryManagerImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/management/MemoryManagerImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -29,6 +29,7 @@
 import java.lang.management.MemoryManagerMXBean;
 import java.lang.management.MemoryPoolMXBean;
 
+import javax.management.MBeanNotificationInfo;
 import javax.management.ObjectName;
 
 /**
@@ -38,7 +39,8 @@
  * ManagementFactory.getMemoryManagerMXBeans() returns a list
  * of instances of this class.
  */
-class MemoryManagerImpl implements MemoryManagerMXBean {
+class MemoryManagerImpl extends NotificationEmitterSupport
+    implements MemoryManagerMXBean {
 
     private final String  name;
     private final boolean isValid;
@@ -76,6 +78,16 @@
     }
     private native MemoryPoolMXBean[] getMemoryPools0();
 
+    private MBeanNotificationInfo[] notifInfo = null;
+    public MBeanNotificationInfo[] getNotificationInfo() {
+        synchronized (this) {
+            if(notifInfo == null) {
+                notifInfo = new MBeanNotificationInfo[0];
+            }
+        }
+        return notifInfo;
+    }
+
     public ObjectName getObjectName() {
         return Util.newObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE, getName());
     }
--- a/jdk/src/share/classes/sun/management/VMManagement.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/management/VMManagement.java	Mon May 16 18:19:34 2011 -0700
@@ -45,6 +45,7 @@
     public boolean isSynchronizerUsageSupported();
     public boolean isThreadAllocatedMemorySupported();
     public boolean isThreadAllocatedMemoryEnabled();
+    public boolean isGcNotificationSupported();
 
     // Class Loading Subsystem
     public long    getTotalClassCount();
--- a/jdk/src/share/classes/sun/management/VMManagementImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/management/VMManagementImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -56,6 +56,8 @@
     private static boolean objectMonitorUsageSupport;
     private static boolean synchronizerUsageSupport;
     private static boolean threadAllocatedMemorySupport;
+    private static boolean gcNotificationSupport;
+
 
     static {
         version = getVersion0();
@@ -100,6 +102,10 @@
         return threadAllocatedMemorySupport;
     }
 
+    public boolean isGcNotificationSupported() {
+        return gcNotificationSupport;
+    }
+
     public native boolean isThreadContentionMonitoringEnabled();
     public native boolean isThreadCpuTimeEnabled();
     public native boolean isThreadAllocatedMemoryEnabled();
--- a/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -28,7 +28,7 @@
 import java.nio.channels.*;
 import java.net.SocketAddress;
 import java.net.SocketOption;
-import java.net.StandardSocketOption;
+import java.net.StandardSocketOptions;
 import java.net.InetSocketAddress;
 import java.io.FileDescriptor;
 import java.io.IOException;
@@ -214,8 +214,8 @@
 
         private static Set<SocketOption<?>> defaultOptions() {
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
-            set.add(StandardSocketOption.SO_RCVBUF);
-            set.add(StandardSocketOption.SO_REUSEADDR);
+            set.add(StandardSocketOptions.SO_RCVBUF);
+            set.add(StandardSocketOptions.SO_REUSEADDR);
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -28,7 +28,7 @@
 import java.nio.ByteBuffer;
 import java.nio.channels.*;
 import java.net.SocketOption;
-import java.net.StandardSocketOption;
+import java.net.StandardSocketOptions;
 import java.net.SocketAddress;
 import java.net.InetSocketAddress;
 import java.io.IOException;
@@ -483,11 +483,11 @@
 
         private static Set<SocketOption<?>> defaultOptions() {
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(5);
-            set.add(StandardSocketOption.SO_SNDBUF);
-            set.add(StandardSocketOption.SO_RCVBUF);
-            set.add(StandardSocketOption.SO_KEEPALIVE);
-            set.add(StandardSocketOption.SO_REUSEADDR);
-            set.add(StandardSocketOption.TCP_NODELAY);
+            set.add(StandardSocketOptions.SO_SNDBUF);
+            set.add(StandardSocketOptions.SO_RCVBUF);
+            set.add(StandardSocketOptions.SO_KEEPALIVE);
+            set.add(StandardSocketOptions.SO_REUSEADDR);
+            set.add(StandardSocketOptions.TCP_NODELAY);
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -188,7 +188,7 @@
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOption.IP_TOS) {
+            if (name == StandardSocketOptions.IP_TOS) {
                 // IPv4 only; no-op for IPv6
                 if (family == StandardProtocolFamily.INET) {
                     Net.setSocketOption(fd, family, name, value);
@@ -196,15 +196,15 @@
                 return this;
             }
 
-            if (name == StandardSocketOption.IP_MULTICAST_TTL ||
-                name == StandardSocketOption.IP_MULTICAST_LOOP)
+            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+                name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 // options are protocol dependent
                 Net.setSocketOption(fd, family, name, value);
                 return this;
             }
 
-            if (name == StandardSocketOption.IP_MULTICAST_IF) {
+            if (name == StandardSocketOptions.IP_MULTICAST_IF) {
                 if (value == null)
                     throw new IllegalArgumentException("Cannot set IP_MULTICAST_IF to 'null'");
                 NetworkInterface interf = (NetworkInterface)value;
@@ -243,7 +243,7 @@
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOption.IP_TOS) {
+            if (name == StandardSocketOptions.IP_TOS) {
                 // IPv4 only; always return 0 on IPv6
                 if (family == StandardProtocolFamily.INET) {
                     return (T) Net.getSocketOption(fd, family, name);
@@ -252,13 +252,13 @@
                 }
             }
 
-            if (name == StandardSocketOption.IP_MULTICAST_TTL ||
-                name == StandardSocketOption.IP_MULTICAST_LOOP)
+            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+                name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 return (T) Net.getSocketOption(fd, family, name);
             }
 
-            if (name == StandardSocketOption.IP_MULTICAST_IF) {
+            if (name == StandardSocketOptions.IP_MULTICAST_IF) {
                 if (family == StandardProtocolFamily.INET) {
                     int address = Net.getInterface4(fd);
                     if (address == 0)
@@ -291,14 +291,14 @@
 
         private static Set<SocketOption<?>> defaultOptions() {
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
-            set.add(StandardSocketOption.SO_SNDBUF);
-            set.add(StandardSocketOption.SO_RCVBUF);
-            set.add(StandardSocketOption.SO_REUSEADDR);
-            set.add(StandardSocketOption.SO_BROADCAST);
-            set.add(StandardSocketOption.IP_TOS);
-            set.add(StandardSocketOption.IP_MULTICAST_IF);
-            set.add(StandardSocketOption.IP_MULTICAST_TTL);
-            set.add(StandardSocketOption.IP_MULTICAST_LOOP);
+            set.add(StandardSocketOptions.SO_SNDBUF);
+            set.add(StandardSocketOptions.SO_RCVBUF);
+            set.add(StandardSocketOptions.SO_REUSEADDR);
+            set.add(StandardSocketOptions.SO_BROADCAST);
+            set.add(StandardSocketOptions.IP_TOS);
+            set.add(StandardSocketOptions.IP_MULTICAST_IF);
+            set.add(StandardSocketOptions.IP_MULTICAST_TTL);
+            set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Mon May 16 18:19:34 2011 -0700
@@ -312,46 +312,46 @@
     public void setSendBufferSize(int size) throws SocketException {
         if (size <= 0)
             throw new IllegalArgumentException("Invalid send size");
-        setIntOption(StandardSocketOption.SO_SNDBUF, size);
+        setIntOption(StandardSocketOptions.SO_SNDBUF, size);
     }
 
     public int getSendBufferSize() throws SocketException {
-        return getIntOption(StandardSocketOption.SO_SNDBUF);
+        return getIntOption(StandardSocketOptions.SO_SNDBUF);
     }
 
     public void setReceiveBufferSize(int size) throws SocketException {
         if (size <= 0)
             throw new IllegalArgumentException("Invalid receive size");
-        setIntOption(StandardSocketOption.SO_RCVBUF, size);
+        setIntOption(StandardSocketOptions.SO_RCVBUF, size);
     }
 
     public int getReceiveBufferSize() throws SocketException {
-        return getIntOption(StandardSocketOption.SO_RCVBUF);
+        return getIntOption(StandardSocketOptions.SO_RCVBUF);
     }
 
     public void setReuseAddress(boolean on) throws SocketException {
-        setBooleanOption(StandardSocketOption.SO_REUSEADDR, on);
+        setBooleanOption(StandardSocketOptions.SO_REUSEADDR, on);
     }
 
     public boolean getReuseAddress() throws SocketException {
-        return getBooleanOption(StandardSocketOption.SO_REUSEADDR);
+        return getBooleanOption(StandardSocketOptions.SO_REUSEADDR);
 
     }
 
     public void setBroadcast(boolean on) throws SocketException {
-        setBooleanOption(StandardSocketOption.SO_BROADCAST, on);
+        setBooleanOption(StandardSocketOptions.SO_BROADCAST, on);
     }
 
     public boolean getBroadcast() throws SocketException {
-        return getBooleanOption(StandardSocketOption.SO_BROADCAST);
+        return getBooleanOption(StandardSocketOptions.SO_BROADCAST);
     }
 
     public void setTrafficClass(int tc) throws SocketException {
-        setIntOption(StandardSocketOption.IP_TOS, tc);
+        setIntOption(StandardSocketOptions.IP_TOS, tc);
     }
 
     public int getTrafficClass() throws SocketException {
-        return getIntOption(StandardSocketOption.IP_TOS);
+        return getIntOption(StandardSocketOptions.IP_TOS);
     }
 
     public void close() {
--- a/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/ExtendedSocketOption.java	Mon May 16 18:19:34 2011 -0700
@@ -29,7 +29,7 @@
 
 /**
  * Defines socket options that are supported by the implementation
- * but not defined in StandardSocketOption.
+ * but not defined in StandardSocketOptions.
  */
 
 class ExtendedSocketOption {
--- a/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java	Mon May 16 18:19:34 2011 -0700
@@ -96,11 +96,16 @@
                     break;
             }
             waitingToEmpty = true;
+            boolean interrupted = false;
             while (used > 0) {
                 try {
                     wait();
-                } catch (InterruptedException ignore) { }
+                } catch (InterruptedException e) {
+                    interrupted = true;
+                }
             }
+            if (interrupted)
+                Thread.currentThread().interrupt();
         }
     }
 }
--- a/jdk/src/share/classes/sun/nio/ch/Net.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/Net.java	Mon May 16 18:19:34 2011 -0700
@@ -237,26 +237,26 @@
             throw new AssertionError("Should not reach here");
 
         // special handling
-        if (name == StandardSocketOption.SO_RCVBUF ||
-            name == StandardSocketOption.SO_SNDBUF)
+        if (name == StandardSocketOptions.SO_RCVBUF ||
+            name == StandardSocketOptions.SO_SNDBUF)
         {
             int i = ((Integer)value).intValue();
             if (i < 0)
                 throw new IllegalArgumentException("Invalid send/receive buffer size");
         }
-        if (name == StandardSocketOption.SO_LINGER) {
+        if (name == StandardSocketOptions.SO_LINGER) {
             int i = ((Integer)value).intValue();
             if (i < 0)
                 value = Integer.valueOf(-1);
             if (i > 65535)
                 value = Integer.valueOf(65535);
         }
-        if (name == StandardSocketOption.IP_TOS) {
+        if (name == StandardSocketOptions.IP_TOS) {
             int i = ((Integer)value).intValue();
             if (i < 0 || i > 255)
                 throw new IllegalArgumentException("Invalid IP_TOS value");
         }
-        if (name == StandardSocketOption.IP_MULTICAST_TTL) {
+        if (name == StandardSocketOptions.IP_MULTICAST_TTL) {
             int i = ((Integer)value).intValue();
             if (i < 0 || i > 255)
                 throw new IllegalArgumentException("Invalid TTL/hop value");
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java	Mon May 16 18:19:34 2011 -0700
@@ -169,7 +169,7 @@
 
     public void setReuseAddress(boolean on) throws SocketException {
         try {
-            ssc.setOption(StandardSocketOption.SO_REUSEADDR, on);
+            ssc.setOption(StandardSocketOptions.SO_REUSEADDR, on);
         } catch (IOException x) {
             Net.translateToSocketException(x);
         }
@@ -177,7 +177,7 @@
 
     public boolean getReuseAddress() throws SocketException {
         try {
-            return ssc.getOption(StandardSocketOption.SO_REUSEADDR).booleanValue();
+            return ssc.getOption(StandardSocketOptions.SO_REUSEADDR).booleanValue();
         } catch (IOException x) {
             Net.translateToSocketException(x);
             return false;       // Never happens
@@ -197,7 +197,7 @@
         if (size <= 0)
             throw new IllegalArgumentException("size cannot be 0 or negative");
         try {
-            ssc.setOption(StandardSocketOption.SO_RCVBUF, size);
+            ssc.setOption(StandardSocketOptions.SO_RCVBUF, size);
         } catch (IOException x) {
             Net.translateToSocketException(x);
         }
@@ -205,7 +205,7 @@
 
     public int getReceiveBufferSize() throws SocketException {
         try {
-            return ssc.getOption(StandardSocketOption.SO_RCVBUF).intValue();
+            return ssc.getOption(StandardSocketOptions.SO_RCVBUF).intValue();
         } catch (IOException x) {
             Net.translateToSocketException(x);
             return -1;          // Never happens
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -160,8 +160,8 @@
 
         private static Set<SocketOption<?>> defaultOptions() {
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
-            set.add(StandardSocketOption.SO_RCVBUF);
-            set.add(StandardSocketOption.SO_REUSEADDR);
+            set.add(StandardSocketOptions.SO_RCVBUF);
+            set.add(StandardSocketOptions.SO_REUSEADDR);
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Mon May 16 18:19:34 2011 -0700
@@ -318,21 +318,21 @@
     }
 
     public void setTcpNoDelay(boolean on) throws SocketException {
-        setBooleanOption(StandardSocketOption.TCP_NODELAY, on);
+        setBooleanOption(StandardSocketOptions.TCP_NODELAY, on);
     }
 
     public boolean getTcpNoDelay() throws SocketException {
-        return getBooleanOption(StandardSocketOption.TCP_NODELAY);
+        return getBooleanOption(StandardSocketOptions.TCP_NODELAY);
     }
 
     public void setSoLinger(boolean on, int linger) throws SocketException {
         if (!on)
             linger = -1;
-        setIntOption(StandardSocketOption.SO_LINGER, linger);
+        setIntOption(StandardSocketOptions.SO_LINGER, linger);
     }
 
     public int getSoLinger() throws SocketException {
-        return getIntOption(StandardSocketOption.SO_LINGER);
+        return getIntOption(StandardSocketOptions.SO_LINGER);
     }
 
     public void sendUrgentData(int data) throws IOException {
@@ -366,46 +366,46 @@
         // size 0 valid for SocketChannel, invalid for Socket
         if (size <= 0)
             throw new IllegalArgumentException("Invalid send size");
-        setIntOption(StandardSocketOption.SO_SNDBUF, size);
+        setIntOption(StandardSocketOptions.SO_SNDBUF, size);
     }
 
     public int getSendBufferSize() throws SocketException {
-        return getIntOption(StandardSocketOption.SO_SNDBUF);
+        return getIntOption(StandardSocketOptions.SO_SNDBUF);
     }
 
     public void setReceiveBufferSize(int size) throws SocketException {
         // size 0 valid for SocketChannel, invalid for Socket
         if (size <= 0)
             throw new IllegalArgumentException("Invalid receive size");
-        setIntOption(StandardSocketOption.SO_RCVBUF, size);
+        setIntOption(StandardSocketOptions.SO_RCVBUF, size);
     }
 
     public int getReceiveBufferSize() throws SocketException {
-        return getIntOption(StandardSocketOption.SO_RCVBUF);
+        return getIntOption(StandardSocketOptions.SO_RCVBUF);
     }
 
     public void setKeepAlive(boolean on) throws SocketException {
-        setBooleanOption(StandardSocketOption.SO_KEEPALIVE, on);
+        setBooleanOption(StandardSocketOptions.SO_KEEPALIVE, on);
     }
 
     public boolean getKeepAlive() throws SocketException {
-        return getBooleanOption(StandardSocketOption.SO_KEEPALIVE);
+        return getBooleanOption(StandardSocketOptions.SO_KEEPALIVE);
     }
 
     public void setTrafficClass(int tc) throws SocketException {
-        setIntOption(StandardSocketOption.IP_TOS, tc);
+        setIntOption(StandardSocketOptions.IP_TOS, tc);
     }
 
     public int getTrafficClass() throws SocketException {
-        return getIntOption(StandardSocketOption.IP_TOS);
+        return getIntOption(StandardSocketOptions.IP_TOS);
     }
 
     public void setReuseAddress(boolean on) throws SocketException {
-        setBooleanOption(StandardSocketOption.SO_REUSEADDR, on);
+        setBooleanOption(StandardSocketOptions.SO_REUSEADDR, on);
     }
 
     public boolean getReuseAddress() throws SocketException {
-        return getBooleanOption(StandardSocketOption.SO_REUSEADDR);
+        return getBooleanOption(StandardSocketOptions.SO_REUSEADDR);
     }
 
     public void close() throws IOException {
--- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -170,7 +170,7 @@
                 throw new ClosedChannelException();
 
             // special handling for IP_TOS: no-op when IPv6
-            if (name == StandardSocketOption.IP_TOS) {
+            if (name == StandardSocketOptions.IP_TOS) {
                 if (!Net.isIPv6Available())
                     Net.setSocketOption(fd, StandardProtocolFamily.INET, name, value);
                 return this;
@@ -197,7 +197,7 @@
                 throw new ClosedChannelException();
 
             // special handling for IP_TOS: always return 0 when IPv6
-            if (name == StandardSocketOption.IP_TOS) {
+            if (name == StandardSocketOptions.IP_TOS) {
                 return (Net.isIPv6Available()) ? (T) Integer.valueOf(0) :
                     (T) Net.getSocketOption(fd, StandardProtocolFamily.INET, name);
             }
@@ -212,14 +212,14 @@
 
         private static Set<SocketOption<?>> defaultOptions() {
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
-            set.add(StandardSocketOption.SO_SNDBUF);
-            set.add(StandardSocketOption.SO_RCVBUF);
-            set.add(StandardSocketOption.SO_KEEPALIVE);
-            set.add(StandardSocketOption.SO_REUSEADDR);
-            set.add(StandardSocketOption.SO_LINGER);
-            set.add(StandardSocketOption.TCP_NODELAY);
+            set.add(StandardSocketOptions.SO_SNDBUF);
+            set.add(StandardSocketOptions.SO_RCVBUF);
+            set.add(StandardSocketOptions.SO_KEEPALIVE);
+            set.add(StandardSocketOptions.SO_REUSEADDR);
+            set.add(StandardSocketOptions.SO_LINGER);
+            set.add(StandardSocketOptions.TCP_NODELAY);
             // additional options required by socket adaptor
-            set.add(StandardSocketOption.IP_TOS);
+            set.add(StandardSocketOptions.IP_TOS);
             set.add(ExtendedSocketOption.SO_OOBINLINE);
             return Collections.unmodifiableSet(set);
         }
--- a/jdk/src/share/classes/sun/nio/fs/AbstractPoller.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/AbstractPoller.java	Mon May 16 18:19:34 2011 -0700
@@ -105,16 +105,16 @@
         Set<WatchEvent.Kind<?>> eventSet = new HashSet<>(events.length);
         for (WatchEvent.Kind<?> event: events) {
             // standard events
-            if (event == StandardWatchEventKind.ENTRY_CREATE ||
-                event == StandardWatchEventKind.ENTRY_MODIFY ||
-                event == StandardWatchEventKind.ENTRY_DELETE)
+            if (event == StandardWatchEventKinds.ENTRY_CREATE ||
+                event == StandardWatchEventKinds.ENTRY_MODIFY ||
+                event == StandardWatchEventKinds.ENTRY_DELETE)
             {
                 eventSet.add(event);
                 continue;
             }
 
             // OVERFLOW is ignored
-            if (event == StandardWatchEventKind.OVERFLOW) {
+            if (event == StandardWatchEventKinds.OVERFLOW) {
                 if (events.length == 1)
                     throw new IllegalArgumentException("No events to register");
                 continue;
--- a/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java	Mon May 16 18:19:34 2011 -0700
@@ -42,8 +42,8 @@
     /**
      * Special event to signal overflow
      */
-    static final Event<Void> OVERFLOW_EVENT =
-        new Event<Void>(StandardWatchEventKind.OVERFLOW, null);
+    static final Event<Object> OVERFLOW_EVENT =
+        new Event<Object>(StandardWatchEventKinds.OVERFLOW, null);
 
     /**
      * Possible key states
@@ -103,14 +103,14 @@
      */
     @SuppressWarnings("unchecked")
     final void signalEvent(WatchEvent.Kind<?> kind, Object context) {
-        boolean isModify = (kind == StandardWatchEventKind.ENTRY_MODIFY);
+        boolean isModify = (kind == StandardWatchEventKinds.ENTRY_MODIFY);
         synchronized (this) {
             int size = events.size();
             if (size > 0) {
                 // if the previous event is an OVERFLOW event or this is a
                 // repeated event then we simply increment the counter
                 WatchEvent<?> prev = events.get(size-1);
-                if ((prev.kind() == StandardWatchEventKind.OVERFLOW) ||
+                if ((prev.kind() == StandardWatchEventKinds.OVERFLOW) ||
                     ((kind == prev.kind() &&
                      Objects.equals(context, prev.context()))))
                 {
@@ -124,7 +124,7 @@
                     if (isModify) {
                         WatchEvent<?> ev = lastModifyEvents.get(context);
                         if (ev != null) {
-                            assert ev.kind() == StandardWatchEventKind.ENTRY_MODIFY;
+                            assert ev.kind() == StandardWatchEventKinds.ENTRY_MODIFY;
                             ((Event<?>)ev).increment();
                             return;
                         }
@@ -138,7 +138,7 @@
                 // if the list has reached the limit then drop pending events
                 // and queue an OVERFLOW event
                 if (size >= MAX_EVENT_LIST_SIZE) {
-                    kind = StandardWatchEventKind.OVERFLOW;
+                    kind = StandardWatchEventKinds.OVERFLOW;
                     isModify = false;
                     context = null;
                 }
@@ -149,7 +149,7 @@
                 new Event<Object>((WatchEvent.Kind<Object>)kind, context);
             if (isModify) {
                 lastModifyEvents.put(context, ev);
-            } else if (kind == StandardWatchEventKind.OVERFLOW) {
+            } else if (kind == StandardWatchEventKinds.OVERFLOW) {
                 // drop all pending events
                 events.clear();
                 lastModifyEvents.clear();
--- a/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java	Mon May 16 18:19:34 2011 -0700
@@ -80,16 +80,16 @@
             new HashSet<WatchEvent.Kind<?>>(events.length);
         for (WatchEvent.Kind<?> event: events) {
             // standard events
-            if (event == StandardWatchEventKind.ENTRY_CREATE ||
-                event == StandardWatchEventKind.ENTRY_MODIFY ||
-                event == StandardWatchEventKind.ENTRY_DELETE)
+            if (event == StandardWatchEventKinds.ENTRY_CREATE ||
+                event == StandardWatchEventKinds.ENTRY_MODIFY ||
+                event == StandardWatchEventKinds.ENTRY_DELETE)
             {
                 eventSet.add(event);
                 continue;
             }
 
             // OVERFLOW is ignored
-            if (event == StandardWatchEventKind.OVERFLOW) {
+            if (event == StandardWatchEventKinds.OVERFLOW) {
                 if (events.length == 1)
                     throw new IllegalArgumentException("No events to register");
                 continue;
@@ -355,16 +355,16 @@
                                      new CacheEntry(lastModified, tickCount));
 
                         // queue ENTRY_CREATE if event enabled
-                        if (events.contains(StandardWatchEventKind.ENTRY_CREATE)) {
-                            signalEvent(StandardWatchEventKind.ENTRY_CREATE, entry.getFileName());
+                        if (events.contains(StandardWatchEventKinds.ENTRY_CREATE)) {
+                            signalEvent(StandardWatchEventKinds.ENTRY_CREATE, entry.getFileName());
                             continue;
                         } else {
                             // if ENTRY_CREATE is not enabled and ENTRY_MODIFY is
                             // enabled then queue event to avoid missing out on
                             // modifications to the file immediately after it is
                             // created.
-                            if (events.contains(StandardWatchEventKind.ENTRY_MODIFY)) {
-                                signalEvent(StandardWatchEventKind.ENTRY_MODIFY, entry.getFileName());
+                            if (events.contains(StandardWatchEventKinds.ENTRY_MODIFY)) {
+                                signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, entry.getFileName());
                             }
                         }
                         continue;
@@ -372,8 +372,8 @@
 
                     // check if file has changed
                     if (e.lastModified != lastModified) {
-                        if (events.contains(StandardWatchEventKind.ENTRY_MODIFY)) {
-                            signalEvent(StandardWatchEventKind.ENTRY_MODIFY,
+                        if (events.contains(StandardWatchEventKinds.ENTRY_MODIFY)) {
+                            signalEvent(StandardWatchEventKinds.ENTRY_MODIFY,
                                         entry.getFileName());
                         }
                     }
@@ -403,8 +403,8 @@
                     Path name = mapEntry.getKey();
                     // remove from map and queue delete event (if enabled)
                     i.remove();
-                    if (events.contains(StandardWatchEventKind.ENTRY_DELETE)) {
-                        signalEvent(StandardWatchEventKind.ENTRY_DELETE, name);
+                    if (events.contains(StandardWatchEventKinds.ENTRY_DELETE)) {
+                        signalEvent(StandardWatchEventKinds.ENTRY_DELETE, name);
                     }
                 }
             }
--- a/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Mon May 16 18:19:34 2011 -0700
@@ -24,22 +24,10 @@
  */
 
 /*
- * ===========================================================================
- *  IBM Confidential
- *  OCO Source Materials
- *  Licensed Materials - Property of IBM
  *
  *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
- *
- *  The source code for this program is not published or otherwise divested of
- *  its trade secrets, irrespective of what has been deposited with the U.S.
- *  Copyright Office.
- *
  *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
- * ===========================================================================
- *
  */
-
 package sun.security.jgss.spi;
 
 import org.ietf.jgss.*;
--- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Mon May 16 18:19:34 2011 -0700
@@ -62,7 +62,7 @@
     // Flag indicating whether EC crypto is available.
     // If null, then we have not checked yet.
     // If yes, then all the EC based crypto we need is available.
-    private static volatile Boolean ecAvailable;
+    private static Boolean ecAvailable;
 
     // Flag indicating whether Kerberos crypto is available.
     // If true, then all the Kerberos-based crypto we need is available.
@@ -190,7 +190,7 @@
         // no instantiation of this class
     }
 
-    static boolean isEcAvailable() {
+    synchronized static boolean isEcAvailable() {
         if (ecAvailable == null) {
             try {
                 JsseJce.getSignature(SIGNATURE_ECDSA);
@@ -206,7 +206,7 @@
         return ecAvailable;
     }
 
-    static void clearEcAvailable() {
+    synchronized static void clearEcAvailable() {
         ecAvailable = null;
     }
 
--- a/jdk/src/share/classes/sun/text/resources/BreakIteratorRules_th.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/classes/sun/text/resources/BreakIteratorRules_th.java	Mon May 16 18:19:34 2011 -0700
@@ -27,17 +27,7 @@
  */
 
 /*
- * IBM Confidential
- * OCO Source Materials
- *
- * IBM Java(tm)2 SDK, Standard Edition, v 1.2
- *
- * (C) Copyright IBM Corp. 1999
- *
- * The source code for this program is not published or otherwise divested of
- * its trade secrets, irrespective of what has been deposited with the U.S.
- * Copyright office.
- *
+ *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
  */
 
 /*
--- a/jdk/src/share/javavm/export/jmm.h	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/javavm/export/jmm.h	Mon May 16 18:19:34 2011 -0700
@@ -48,7 +48,7 @@
   JMM_VERSION_1_0 = 0x20010000,
   JMM_VERSION_1_1 = 0x20010100, // JDK 6
   JMM_VERSION_1_2 = 0x20010200, // JDK 7
-  JMM_VERSION     = 0x20010200
+  JMM_VERSION     = 0x20010201
 };
 
 typedef struct {
@@ -293,6 +293,9 @@
                                                   jlongArray ids,
                                                   jboolean lockedMonitors,
                                                   jboolean lockedSynchronizers);
+   void         (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
+                                                  jobject mgr,
+                                                  jboolean enabled);
 } JmmInterface;
 
 #ifdef __cplusplus
--- a/jdk/src/share/native/sun/management/GarbageCollectorImpl.c	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/native/sun/management/GarbageCollectorImpl.c	Mon May 16 18:19:34 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -36,3 +36,17 @@
   (JNIEnv *env, jobject mgr) {
     return jmm_interface->GetLongAttribute(env, mgr, JMM_GC_TIME_MS);
 }
+
+
+JNIEXPORT void JNICALL Java_sun_management_GarbageCollectorImpl_setNotificationEnabled
+(JNIEnv *env, jobject dummy, jobject gc,jboolean enabled) {
+
+    if (gc == NULL) {
+        JNU_ThrowNullPointerException(env, "Invalid GarbageCollectorMBean");
+        return;
+    }
+    if((jmm_version > JMM_VERSION_1_2)
+       || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=1))) {
+      jmm_interface->SetGCNotificationEnabled(env, gc, enabled);
+    }
+}
--- a/jdk/src/share/native/sun/management/VMManagementImpl.c	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/native/sun/management/VMManagementImpl.c	Mon May 16 18:19:34 2011 -0700
@@ -95,6 +95,13 @@
 
     value = mos.isThreadAllocatedMemorySupported;
     setStaticBooleanField(env, cls, "threadAllocatedMemorySupport", value);
+
+    if ((jmm_version > JMM_VERSION_1_2) ||
+        (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF) >= 1))) {
+        setStaticBooleanField(env, cls, "gcNotificationSupport", JNI_TRUE);
+    } else {
+        setStaticBooleanField(env, cls, "gcNotificationSupport", JNI_FALSE);
+    }
 }
 
 JNIEXPORT jobjectArray JNICALL
--- a/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Mon May 16 18:19:34 2011 -0700
@@ -63,7 +63,7 @@
     out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
     out("package sun.nio.ch;                                                            ");
     out("import java.net.SocketOption;                                                  ");
-    out("import java.net.StandardSocketOption;                                          ");
+    out("import java.net.StandardSocketOptions;                                         ");
     out("import java.net.ProtocolFamily;                                                ");
     out("import java.net.StandardProtocolFamily;                                        ");
     out("import java.util.Map;                                                          ");
@@ -73,7 +73,7 @@
     out("    private static class RegistryKey {                                         ");
     out("        private final SocketOption<?> name;                                    ");
     out("        private final ProtocolFamily family;                                   ");
-    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {                ");
+    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {             ");
     out("            this.name = name;                                                  ");
     out("            this.family = family;                                              ");
     out("        }                                                                      ");
@@ -95,23 +95,23 @@
     out("            Map<RegistryKey,OptionKey> map =                                   ");
     out("                new HashMap<RegistryKey,OptionKey>();                          ");
 
-    emit_unspec("StandardSocketOption.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
-    emit_unspec("StandardSocketOption.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
-    emit_unspec("StandardSocketOption.SO_LINGER",    SOL_SOCKET, SO_LINGER);
-    emit_unspec("StandardSocketOption.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
-    emit_unspec("StandardSocketOption.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
-    emit_unspec("StandardSocketOption.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
-    emit_unspec("StandardSocketOption.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
+    emit_unspec("StandardSocketOptions.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
+    emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
+    emit_unspec("StandardSocketOptions.SO_LINGER",    SOL_SOCKET, SO_LINGER);
+    emit_unspec("StandardSocketOptions.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
+    emit_unspec("StandardSocketOptions.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
+    emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
+    emit_unspec("StandardSocketOptions.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
 
-    emit_inet("StandardSocketOption.IP_TOS",            IPPROTO_IP,     IP_TOS);
-    emit_inet("StandardSocketOption.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
-    emit_inet("StandardSocketOption.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
-    emit_inet("StandardSocketOption.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
+    emit_inet("StandardSocketOptions.IP_TOS",            IPPROTO_IP,     IP_TOS);
+    emit_inet("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
+    emit_inet("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
+    emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
 
 #ifdef AF_INET6
-    emit_inet6("StandardSocketOption.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
-    emit_inet6("StandardSocketOption.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
-    emit_inet6("StandardSocketOption.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
+    emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
+    emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
+    emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
 #endif
 
     emit_unspec("ExtendedSocketOption.SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE);
--- a/jdk/src/share/sample/nio/chatserver/ChatServer.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/sample/nio/chatserver/ChatServer.java	Mon May 16 18:19:34 2011 -0700
@@ -32,7 +32,7 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
-import java.net.StandardSocketOption;
+import java.net.StandardSocketOptions;
 import java.nio.channels.*;
 import java.util.*;
 import java.util.concurrent.Executors;
@@ -105,7 +105,7 @@
     */
     private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException {
         final AsynchronousServerSocketChannel listener = openChannel(channelGroup);
-        listener.setOption(StandardSocketOption.SO_REUSEADDR, true);
+        listener.setOption(StandardSocketOptions.SO_REUSEADDR, true);
         listener.bind(new InetSocketAddress(port));
         return listener;
     }
@@ -123,7 +123,7 @@
     private void handleNewConnection(AsynchronousSocketChannel channel) {
         Client client = new Client(channel, new ClientReader(this, new NameReader(this)));
         try {
-            channel.setOption(StandardSocketOption.TCP_NODELAY, true);
+            channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
         } catch (IOException e) {
             // ignore
         }
--- a/jdk/src/share/sample/nio/file/WatchDir.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/sample/nio/file/WatchDir.java	Mon May 16 18:19:34 2011 -0700
@@ -30,7 +30,7 @@
  */
 
 import java.nio.file.*;
-import static java.nio.file.StandardWatchEventKind.*;
+import static java.nio.file.StandardWatchEventKinds.*;
 import static java.nio.file.LinkOption.*;
 import java.nio.file.attribute.*;
 import java.io.IOException;
--- a/jdk/src/share/sample/nio/multicast/Reader.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/sample/nio/multicast/Reader.java	Mon May 16 18:19:34 2011 -0700
@@ -96,7 +96,7 @@
             family = StandardProtocolFamily.INET6;
         }
         DatagramChannel dc = DatagramChannel.open(family)
-            .setOption(StandardSocketOption.SO_REUSEADDR, true)
+            .setOption(StandardSocketOptions.SO_REUSEADDR, true)
             .bind(new InetSocketAddress(target.port()));
 
         if (includeList.isEmpty()) {
--- a/jdk/src/share/sample/nio/multicast/Sender.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/share/sample/nio/multicast/Sender.java	Mon May 16 18:19:34 2011 -0700
@@ -59,7 +59,7 @@
             family = StandardProtocolFamily.INET6;
         DatagramChannel dc = DatagramChannel.open(family).bind(new InetSocketAddress(0));
         if (target.interf() != null) {
-            dc.setOption(StandardSocketOption.IP_MULTICAST_IF, target.interf());
+            dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, target.interf());
         }
 
         // send multicast packet
--- a/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -55,7 +55,7 @@
 import com.sun.nio.sctp.SctpSocketOption;
 import sun.nio.ch.PollArrayWrapper;
 import sun.nio.ch.SelChImpl;
-import static com.sun.nio.sctp.SctpStandardSocketOption.*;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static sun.nio.ch.SctpResultContainer.SEND_FAILED;
 import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED;
 import static sun.nio.ch.SctpResultContainer.PEER_ADDRESS_CHANGED;
--- a/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -53,7 +53,7 @@
 import com.sun.nio.sctp.SctpChannel;
 import com.sun.nio.sctp.SctpMultiChannel;
 import com.sun.nio.sctp.SctpSocketOption;
-import static com.sun.nio.sctp.SctpStandardSocketOption.*;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static sun.nio.ch.SctpResultContainer.*;
 
 /**
--- a/jdk/src/solaris/classes/sun/nio/ch/SctpNet.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/ch/SctpNet.java	Mon May 16 18:19:34 2011 -0700
@@ -35,7 +35,7 @@
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
 import com.sun.nio.sctp.SctpSocketOption;
-import static com.sun.nio.sctp.SctpStandardSocketOption.*;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 
 public class SctpNet {
     static final String osName = AccessController.doPrivileged(
--- a/jdk/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Mon May 16 18:19:34 2011 -0700
@@ -40,7 +40,7 @@
 import com.sun.nio.sctp.SctpChannel;
 import com.sun.nio.sctp.SctpServerChannel;
 import com.sun.nio.sctp.SctpSocketOption;
-import com.sun.nio.sctp.SctpStandardSocketOption;
+import com.sun.nio.sctp.SctpStandardSocketOptions;
 
 /**
  * An implementation of SctpServerChannel
@@ -386,7 +386,7 @@
 
         private static Set<SctpSocketOption<?>> defaultOptions() {
             HashSet<SctpSocketOption<?>> set = new HashSet<SctpSocketOption<?>>(1);
-            set.add(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS);
+            set.add(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS);
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Mon May 16 18:19:34 2011 -0700
@@ -210,15 +210,15 @@
 
             int mask = 0;
             for (WatchEvent.Kind<?> event: events) {
-                if (event == StandardWatchEventKind.ENTRY_CREATE) {
+                if (event == StandardWatchEventKinds.ENTRY_CREATE) {
                     mask |= IN_CREATE | IN_MOVED_TO;
                     continue;
                 }
-                if (event == StandardWatchEventKind.ENTRY_DELETE) {
+                if (event == StandardWatchEventKinds.ENTRY_DELETE) {
                     mask |= IN_DELETE | IN_MOVED_FROM;
                     continue;
                 }
-                if (event == StandardWatchEventKind.ENTRY_MODIFY) {
+                if (event == StandardWatchEventKinds.ENTRY_MODIFY) {
                     mask |= IN_MODIFY | IN_ATTRIB;
                     continue;
                 }
@@ -378,17 +378,17 @@
          */
         private WatchEvent.Kind<?> maskToEventKind(int mask) {
             if ((mask & IN_MODIFY) > 0)
-                return StandardWatchEventKind.ENTRY_MODIFY;
+                return StandardWatchEventKinds.ENTRY_MODIFY;
             if ((mask & IN_ATTRIB) > 0)
-                return StandardWatchEventKind.ENTRY_MODIFY;
+                return StandardWatchEventKinds.ENTRY_MODIFY;
             if ((mask & IN_CREATE) > 0)
-                return StandardWatchEventKind.ENTRY_CREATE;
+                return StandardWatchEventKinds.ENTRY_CREATE;
             if ((mask & IN_MOVED_TO) > 0)
-                return StandardWatchEventKind.ENTRY_CREATE;
+                return StandardWatchEventKinds.ENTRY_CREATE;
             if ((mask & IN_DELETE) > 0)
-                return StandardWatchEventKind.ENTRY_DELETE;
+                return StandardWatchEventKinds.ENTRY_DELETE;
             if ((mask & IN_MOVED_FROM) > 0)
-                return StandardWatchEventKind.ENTRY_DELETE;
+                return StandardWatchEventKinds.ENTRY_DELETE;
             return null;
         }
 
@@ -400,7 +400,7 @@
             if ((mask & IN_Q_OVERFLOW) > 0) {
                 for (Map.Entry<Integer,LinuxWatchKey> entry: wdToKey.entrySet()) {
                     entry.getValue()
-                        .signalEvent(StandardWatchEventKind.OVERFLOW, null);
+                        .signalEvent(StandardWatchEventKinds.OVERFLOW, null);
                 }
                 return;
             }
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java	Mon May 16 18:19:34 2011 -0700
@@ -486,7 +486,7 @@
         void processDirectoryEvents(SolarisWatchKey key, int mask) {
             if ((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) {
                 registerChildren(key.getDirectory(), key,
-                    key.events().contains(StandardWatchEventKind.ENTRY_CREATE));
+                    key.events().contains(StandardWatchEventKinds.ENTRY_CREATE));
             }
         }
 
@@ -504,14 +504,14 @@
 
             // entry modified
             if (((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) &&
-                events.contains(StandardWatchEventKind.ENTRY_MODIFY))
+                events.contains(StandardWatchEventKinds.ENTRY_MODIFY))
             {
-                key.signalEvent(StandardWatchEventKind.ENTRY_MODIFY, node.name());
+                key.signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, node.name());
             }
 
             // entry removed
             if (((mask & (FILE_REMOVED)) != 0) &&
-                events.contains(StandardWatchEventKind.ENTRY_DELETE))
+                events.contains(StandardWatchEventKinds.ENTRY_DELETE))
             {
                 // Due to 6636438/6636412 we may get a remove event for cases
                 // where a rmdir/unlink/rename is attempted but fails. Until
@@ -527,7 +527,7 @@
                 } catch (UnixException x) { }
 
                 if (removed)
-                    key.signalEvent(StandardWatchEventKind.ENTRY_DELETE, node.name());
+                    key.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, node.name());
             }
             return false;
         }
@@ -547,7 +547,7 @@
             // if the ENTRY_MODIFY event is not enabled then we don't need
             // modification events for entries in the directory
             int events = FILE_NOFOLLOW;
-            if (parent.events().contains(StandardWatchEventKind.ENTRY_MODIFY))
+            if (parent.events().contains(StandardWatchEventKinds.ENTRY_MODIFY))
                 events |= (FILE_MODIFIED | FILE_ATTRIB);
 
             DirectoryStream<Path> stream = null;
@@ -567,7 +567,7 @@
 
                     // send ENTRY_CREATE if enabled
                     if (sendEvents) {
-                        parent.signalEvent(StandardWatchEventKind.ENTRY_CREATE, name);
+                        parent.signalEvent(StandardWatchEventKinds.ENTRY_CREATE, name);
                     }
 
                     // register it
@@ -602,12 +602,12 @@
             // update events, rembering if ENTRY_MODIFY was previously
             // enabled or disabled.
             boolean wasModifyEnabled = key.events()
-                .contains(StandardWatchEventKind.ENTRY_MODIFY);
+                .contains(StandardWatchEventKinds.ENTRY_MODIFY);
             key.setEvents(events);
 
             // check if ENTRY_MODIFY has changed
             boolean isModifyEnabled = events
-                .contains(StandardWatchEventKind.ENTRY_MODIFY);
+                .contains(StandardWatchEventKinds.ENTRY_MODIFY);
             if (wasModifyEnabled == isModifyEnabled) {
                 return;
             }
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Mon May 16 18:19:34 2011 -0700
@@ -892,8 +892,9 @@
 
         if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
             /* not found or error */
-            if (errno != 0 && errno != ENOENT)
-                throwUnixException(env, errno);
+            if (errno == 0)
+                errno = ENOENT;
+            throwUnixException(env, errno);
         } else {
             jsize len = strlen(p->pw_name);
             result = (*env)->NewByteArray(env, len);
@@ -941,14 +942,14 @@
         retry = 0;
         if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
             /* not found or error */
-            if (errno != 0 && errno != ENOENT) {
-                if (errno == ERANGE) {
-                    /* insufficient buffer size so need larger buffer */
-                    buflen += ENT_BUF_SIZE;
-                    retry = 1;
-                } else {
-                    throwUnixException(env, errno);
-                }
+            if (errno == ERANGE) {
+                /* insufficient buffer size so need larger buffer */
+                buflen += ENT_BUF_SIZE;
+                retry = 1;
+            } else {
+                if (errno == 0)
+                    errno = ENOENT;
+                throwUnixException(env, errno);
             }
         } else {
             jsize len = strlen(g->gr_name);
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsWatchService.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsWatchService.java	Mon May 16 18:19:34 2011 -0700
@@ -464,15 +464,15 @@
         {
             switch (action) {
                 case FILE_ACTION_MODIFIED :
-                    return StandardWatchEventKind.ENTRY_MODIFY;
+                    return StandardWatchEventKinds.ENTRY_MODIFY;
 
                 case FILE_ACTION_ADDED :
                 case FILE_ACTION_RENAMED_NEW_NAME :
-                    return StandardWatchEventKind.ENTRY_CREATE;
+                    return StandardWatchEventKinds.ENTRY_CREATE;
 
                 case FILE_ACTION_REMOVED :
                 case FILE_ACTION_RENAMED_OLD_NAME :
-                    return StandardWatchEventKind.ENTRY_DELETE;
+                    return StandardWatchEventKinds.ENTRY_DELETE;
 
                 default :
                     return null;  // action not recognized
@@ -548,7 +548,7 @@
                 if (info.error() != 0) {
                     // buffer overflow
                     if (info.error() == ERROR_NOTIFY_ENUM_DIR) {
-                        key.signalEvent(StandardWatchEventKind.OVERFLOW, null);
+                        key.signalEvent(StandardWatchEventKinds.OVERFLOW, null);
                     } else {
                         // other error so cancel key
                         implCancelKey(key);
@@ -562,7 +562,7 @@
                     processEvents(key, info.bytesTransferred());
                 } else {
                     // insufficient buffer size
-                    key.signalEvent(StandardWatchEventKind.OVERFLOW, null);
+                    key.signalEvent(StandardWatchEventKinds.OVERFLOW, null);
                 }
 
                 // start read for next batch of changes
--- a/jdk/src/windows/native/sun/security/mscapi/security.cpp	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/src/windows/native/sun/security/mscapi/security.cpp	Mon May 16 18:19:34 2011 -0700
@@ -705,7 +705,7 @@
     HCRYPTPROV hCryptProv = NULL;
     HCRYPTKEY hKeyPair;
     DWORD dwFlags = (keySize << 16) | CRYPT_EXPORTABLE;
-    jobject keypair;
+    jobject keypair = NULL;
     const char* pszKeyContainerName = NULL; // UUID
 
     __try
--- a/jdk/test/ProblemList.txt	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/ProblemList.txt	Mon May 16 18:19:34 2011 -0700
@@ -195,6 +195,9 @@
 
 # jdk_lang
 
+# requires junit
+java/lang/invoke/InvokeDynamicPrintArgs.java                    generic-all
+
 # Times out on solaris 10 sparc
 java/lang/ClassLoader/Assert.java				generic-all
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2011, 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     7036199
+ * @summary Check that GarbageCollectionNotification contents are reasonable
+ * @author  Frederic Parain
+ * @run     main/othervm GarbageCollectionNotificationContentTest
+ */
+
+import java.util.*;
+import java.lang.management.*;
+import java.lang.reflect.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import com.sun.management.GarbageCollectionNotificationInfo;
+import com.sun.management.GcInfo;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+public class GarbageCollectionNotificationContentTest {
+    private static HashMap<String,GarbageCollectionNotificationInfo> listenerInvoked
+        = new HashMap<String,GarbageCollectionNotificationInfo>();
+    static volatile long count = 0;
+    static volatile long number = 0;
+    static Object synchronizer = new Object();
+
+    static class GcListener implements NotificationListener {
+        public void handleNotification(Notification notif, Object handback) {
+            String type = notif.getType();
+            if (type.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
+                GarbageCollectionNotificationInfo gcNotif =
+                    GarbageCollectionNotificationInfo.from((CompositeData) notif.getUserData());
+                String source = ((ObjectName)notif.getSource()).getCanonicalName();
+                synchronized(synchronizer) {
+                    if(listenerInvoked.get(source) == null) {
+                            listenerInvoked.put(((ObjectName)notif.getSource()).getCanonicalName(),gcNotif);
+                            count++;
+                            if(count >= number) {
+                                synchronizer.notify();
+                            }
+                    }
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
+                public Boolean run() {
+                    try {
+                        Class cl = Class.forName("sun.management.VMManagementImpl");
+                        Field f = cl.getDeclaredField("gcNotificationSupport");
+                        f.setAccessible(true);
+                        return f.getBoolean(null);
+                    } catch(ClassNotFoundException e) {
+                        return false;
+                    } catch(NoSuchFieldException e) {
+                        return false;
+                    } catch(IllegalAccessException e) {
+                        return false;
+                    }
+                }
+            });
+        if(!isNotificationSupported) {
+            System.out.println("GC Notification not supported by the JVM, test skipped");
+            return;
+        }
+        final ObjectName gcMXBeanPattern =
+                new ObjectName("java.lang:type=GarbageCollector,*");
+        Set<ObjectName> names =
+                mbs.queryNames(gcMXBeanPattern, null);
+        if (names.isEmpty())
+            throw new Exception("Test incorrect: no GC MXBeans");
+        number = names.size();
+        for (ObjectName n : names) {
+            if(mbs.isInstanceOf(n,"javax.management.NotificationEmitter")) {
+                listenerInvoked.put(n.getCanonicalName(),null);
+                GcListener listener = new GcListener();
+                mbs.addNotificationListener(n, listener, null, null);
+            }
+        }
+        // Invocation of System.gc() to trigger major GC
+        System.gc();
+        // Allocation of many short living and small objects to trigger minor GC
+        Object data[] = new Object[32];
+        for(int i = 0; i<100000000; i++) {
+            data[i%32] = new int[8];
+        }
+        int wakeup = 0;
+        synchronized(synchronizer) {
+            while(count != number) {
+                synchronizer.wait(10000);
+                wakeup++;
+                if(wakeup > 10)
+                    break;
+            }
+        }
+        for (GarbageCollectionNotificationInfo notif : listenerInvoked.values() ) {
+            checkGarbageCollectionNotificationInfoContent(notif);
+        }
+        System.out.println("Test passed");
+    }
+
+    private static void checkGarbageCollectionNotificationInfoContent(GarbageCollectionNotificationInfo notif) throws Exception {
+        System.out.println("GC notification for "+notif.getGcName());
+        System.out.print("Action: "+notif.getGcAction());
+        System.out.println(" Cause: "+notif.getGcCause());
+        GcInfo info = notif.getGcInfo();
+        System.out.print("GC Info #" + info.getId());
+        System.out.print(" start:" + info.getStartTime());
+        System.out.print(" end:" + info.getEndTime());
+        System.out.println(" (" + info.getDuration() + "ms)");
+        Map<String, MemoryUsage> usage = info.getMemoryUsageBeforeGc();
+
+        List<String> pnames = new ArrayList<String>();
+        for (Map.Entry entry : usage.entrySet() ) {
+            String poolname = (String) entry.getKey();
+            pnames.add(poolname);
+            MemoryUsage busage = (MemoryUsage) entry.getValue();
+            MemoryUsage ausage = (MemoryUsage) info.getMemoryUsageAfterGc().get(poolname);
+            if (ausage == null) {
+                throw new RuntimeException("After Gc Memory does not exist" +
+                    " for " + poolname);
+            }
+            System.out.println("Usage for pool " + poolname);
+            System.out.println("   Before GC: " + busage);
+            System.out.println("   After GC: " + ausage);
+        }
+
+        // check if memory usage for all memory pools are returned
+        List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
+        for (MemoryPoolMXBean p : pools ) {
+            if (!pnames.contains(p.getName())) {
+                throw new RuntimeException("GcInfo does not contain " +
+                    "memory usage for pool " + p.getName());
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2011, 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     7036199
+ * @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
+ * @author  Frederic Parain
+ * @run     main/othervm GarbageCollectionNotificationTest
+ */
+
+import java.util.*;
+import java.lang.management.*;
+import java.lang.reflect.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import com.sun.management.GarbageCollectionNotificationInfo;
+import com.sun.management.GcInfo;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+public class GarbageCollectionNotificationTest {
+    private static HashMap<String,Boolean> listenerInvoked = new HashMap<String,Boolean>();
+    static volatile long count = 0;
+    static volatile long number = 0;
+    static Object synchronizer = new Object();
+
+    static class GcListener implements NotificationListener {
+        public void handleNotification(Notification notif, Object handback) {
+            String type = notif.getType();
+            if (type.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
+                GarbageCollectionNotificationInfo gcNotif =
+                    GarbageCollectionNotificationInfo.from((CompositeData) notif.getUserData());
+                String source = ((ObjectName)notif.getSource()).getCanonicalName();
+                synchronized(synchronizer) {
+                    if(!listenerInvoked.get(source)) {
+                            listenerInvoked.put(((ObjectName)notif.getSource()).getCanonicalName(),true);
+                            count++;
+                            if(count >= number) {
+                                synchronizer.notify();
+                            }
+                    }
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
+                public Boolean run() {
+                    try {
+                        Class cl = Class.forName("sun.management.VMManagementImpl");
+                        Field f = cl.getDeclaredField("gcNotificationSupport");
+                        f.setAccessible(true);
+                        return f.getBoolean(null);
+                    } catch(ClassNotFoundException e) {
+                        return false;
+                    } catch(NoSuchFieldException e) {
+                        return false;
+                    } catch(IllegalAccessException e) {
+                        return false;
+                    }
+                }
+            });
+        if(!isNotificationSupported) {
+            System.out.println("GC Notification not supported by the JVM, test skipped");
+            return;
+        }
+        final ObjectName gcMXBeanPattern =
+                new ObjectName("java.lang:type=GarbageCollector,*");
+        Set<ObjectName> names =
+                mbs.queryNames(gcMXBeanPattern, null);
+        if (names.isEmpty())
+            throw new Exception("Test incorrect: no GC MXBeans");
+        number = names.size();
+        for (ObjectName n : names) {
+            if(mbs.isInstanceOf(n,"javax.management.NotificationEmitter")) {
+                listenerInvoked.put(n.getCanonicalName(),false);
+                GcListener listener = new GcListener();
+                mbs.addNotificationListener(n, listener, null, null);
+            }
+        }
+        // Invocation of System.gc() to trigger major GC
+        System.gc();
+        // Allocation of many short living and small objects to trigger minor GC
+        Object data[] = new Object[32];
+        for(int i = 0; i<100000000; i++) {
+            data[i%32] = new int[8];
+        }
+        int wakeup = 0;
+        synchronized(synchronizer) {
+            while(count != number) {
+                synchronizer.wait(10000);
+                wakeup++;
+                if(wakeup > 10)
+                    break;
+            }
+        }
+        for (String source : listenerInvoked.keySet()) {
+            if(!listenerInvoked.get(source))
+                throw new Exception("Test incorrect: notifications have not been sent for "
+                                    + source);
+        }
+        System.out.println("Test passed");
+    }
+}
--- a/jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java	Mon May 16 18:19:34 2011 -0700
@@ -40,7 +40,7 @@
 import com.sun.nio.sctp.SctpSocketOption;
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
-import static com.sun.nio.sctp.SctpStandardSocketOption.*;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static java.lang.System.out;
 
 public class SocketOptionTests {
--- a/jdk/test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java	Mon May 16 18:19:34 2011 -0700
@@ -48,7 +48,7 @@
 import com.sun.nio.sctp.SctpSocketOption;
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
-import static com.sun.nio.sctp.SctpStandardSocketOption.*;
+import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static java.lang.System.out;
 
 public class SocketOptionTests {
--- a/jdk/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java	Mon May 16 18:19:34 2011 -0700
@@ -29,7 +29,7 @@
 
 import java.nio.channels.*;
 import java.net.*;
-import static java.net.StandardSocketOption.*;
+import static java.net.StandardSocketOptions.*;
 import java.io.IOException;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Mon May 16 18:19:34 2011 -0700
@@ -29,7 +29,7 @@
 
 import java.nio.ByteBuffer;
 import java.nio.channels.*;
-import static java.net.StandardSocketOption.*;
+import static java.net.StandardSocketOptions.*;
 import java.net.*;
 import java.util.Random;
 import java.util.concurrent.*;
@@ -383,7 +383,7 @@
         // write bytes and close connection
         SocketChannel sc = server.accept();
         ByteBuffer src = genBuffer();
-        sc.setOption(StandardSocketOption.SO_SNDBUF, src.remaining());
+        sc.setOption(StandardSocketOptions.SO_SNDBUF, src.remaining());
         while (src.hasRemaining())
             sc.write(src);
         sc.close();
--- a/jdk/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java	Mon May 16 18:19:34 2011 -0700
@@ -52,7 +52,7 @@
             StandardProtocolFamily.INET : StandardProtocolFamily.INET6;
 
         DatagramChannel dc = DatagramChannel.open(family)
-            .setOption(StandardSocketOption.SO_REUSEADDR, true)
+            .setOption(StandardSocketOptions.SO_REUSEADDR, true)
             .bind(new InetSocketAddress(source, 0));
 
         // check existing key is returned
@@ -115,7 +115,7 @@
         System.out.println("Exception Tests");
 
         DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET)
-            .setOption(StandardSocketOption.SO_REUSEADDR, true)
+            .setOption(StandardSocketOptions.SO_REUSEADDR, true)
             .bind(new InetSocketAddress(0));
 
         InetAddress group = InetAddress.getByName("225.4.5.6");
--- a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java	Mon May 16 18:19:34 2011 -0700
@@ -59,7 +59,7 @@
             StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
         DatagramChannel dc = DatagramChannel.open(family)
             .bind(new InetSocketAddress(local, 0))
-            .setOption(StandardSocketOption.IP_MULTICAST_IF, nif);
+            .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif);
         int id = rand.nextInt();
         byte[] msg = Integer.toString(id).getBytes("UTF-8");
         ByteBuffer buf = ByteBuffer.wrap(msg);
@@ -146,7 +146,7 @@
         System.out.format("\nTest DatagramChannel to %s socket\n", family.name());
         try (DatagramChannel dc = (family == UNSPEC) ?
                 DatagramChannel.open() : DatagramChannel.open(family)) {
-            dc.setOption(StandardSocketOption.SO_REUSEADDR, true)
+            dc.setOption(StandardSocketOptions.SO_REUSEADDR, true)
               .bind(new InetSocketAddress(0));
 
             // join group
--- a/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java	Mon May 16 18:19:34 2011 -0700
@@ -31,7 +31,7 @@
 import java.net.*;
 import java.io.IOException;
 import java.util.*;
-import static java.net.StandardSocketOption.*;
+import static java.net.StandardSocketOptions.*;
 
 public class SocketOptionTests {
 
--- a/jdk/test/java/nio/channels/FileChannel/ClosedByInterrupt.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/FileChannel/ClosedByInterrupt.java	Mon May 16 18:19:34 2011 -0700
@@ -52,13 +52,16 @@
                 fc.write(bb);
         }
 
-        // test with 1-8 concurrent threads
-        for (int i=1; i<=8; i++) {
+        // test with 1-16 concurrent threads
+        for (int i=1; i<=16; i++) {
             System.out.format("%d thread(s)%n", i);
             test(f, i);
             if (failed)
                 break;
         }
+
+        if (failed)
+            throw new RuntimeException("Test failed");
     }
 
     /**
@@ -132,12 +135,14 @@
                         // give the interruptible thread a chance
                         try {
                             Thread.sleep(rand.nextInt(50));
-                        } catch (InterruptedException ignore) { }
+                        } catch (InterruptedException e) {
+                            unexpected(e);
+                        }
                     }
                 }
             } catch (ClosedByInterruptException e) {
                 if (interruptible) {
-                    if (Thread.currentThread().isInterrupted()) {
+                    if (Thread.interrupted()) {
                         expected(e + " thrown and interrupt status set");
                     } else {
                         unexpected(e + " thrown but interrupt status not set");
@@ -158,7 +163,7 @@
     }
 
     static void expected(Exception e) {
-        System.out.format("%s (not expected)%n", e);
+        System.out.format("%s (expected)%n", e);
     }
 
     static void expected(String msg) {
--- a/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Mon May 16 18:19:34 2011 -0700
@@ -32,7 +32,7 @@
 import java.net.*;
 import java.io.IOException;
 import java.util.*;
-import static java.net.StandardSocketOption.*;
+import static java.net.StandardSocketOptions.*;
 
 public class SocketOptionTests {
 
--- a/jdk/test/java/nio/channels/SocketChannel/Shutdown.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/Shutdown.java	Mon May 16 18:19:34 2011 -0700
@@ -39,7 +39,7 @@
     static void acceptAndReset(ServerSocketChannel ssc) throws IOException {
         SocketChannel peer = ssc.accept();
         try {
-            peer.setOption(StandardSocketOption.SO_LINGER, 0);
+            peer.setOption(StandardSocketOptions.SO_LINGER, 0);
             peer.configureBlocking(false);
             peer.write(ByteBuffer.wrap(new byte[128*1024]));
         } finally {
--- a/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java	Mon May 16 18:19:34 2011 -0700
@@ -32,7 +32,7 @@
 import java.net.*;
 import java.io.IOException;
 import java.util.*;
-import static java.net.StandardSocketOption.*;
+import static java.net.StandardSocketOptions.*;
 
 public class SocketOptionTests {
 
--- a/jdk/test/java/nio/charset/StandardCharset/Standard.java	Mon May 16 18:17:26 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2011, 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 4884238
- * @summary Test standard charset name constants.
- * @author Mike Duigou
- * @run main Standard
- */
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.io.*;
-import java.nio.charset.*;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class Standard {
-
-    private final static String standardCharsets[] = {
-        "US-ASCII", "ISO-8859-1", "UTF-8",
-        "UTF-16BE", "UTF-16LE", "UTF-16" };
-
-    public static void realMain(String[] args) {
-        check(StandardCharset.US_ASCII instanceof Charset);
-        check(StandardCharset.ISO_8859_1 instanceof Charset);
-        check(StandardCharset.UTF_8 instanceof Charset);
-        check(StandardCharset.UTF_16BE instanceof Charset);
-        check(StandardCharset.UTF_16LE instanceof Charset);
-        check(StandardCharset.UTF_16 instanceof Charset);
-
-        check("US-ASCII".equals(StandardCharset.US_ASCII.name()));
-        check("ISO-8859-1".equals(StandardCharset.ISO_8859_1.name()));
-        check("UTF-8".equals(StandardCharset.UTF_8.name()));
-        check("UTF-16BE".equals(StandardCharset.UTF_16BE.name()));
-        check("UTF-16LE".equals(StandardCharset.UTF_16LE.name()));
-        check("UTF-16".equals(StandardCharset.UTF_16.name()));
-
-        Set<String> charsets = new HashSet<>();
-        Field standardCharsetFields[] = StandardCharset.class.getFields();
-
-        for(Field charsetField : standardCharsetFields) {
-            check(StandardCharset.class == charsetField.getDeclaringClass());
-            check(Modifier.isFinal(charsetField.getModifiers()));
-            check(Modifier.isStatic(charsetField.getModifiers()));
-            check(Modifier.isPublic(charsetField.getModifiers()));
-            Object value;
-            try {
-                value = charsetField.get(null);
-            } catch(IllegalAccessException failure) {
-                unexpected(failure);
-                continue;
-            }
-            check(value instanceof Charset);
-            charsets.add(((Charset)value).name());
-        }
-
-        check(charsets.containsAll(Arrays.asList(standardCharsets)));
-        charsets.removeAll(Arrays.asList(standardCharsets));
-        check(charsets.isEmpty());
-    }
-
-    //--------------------- Infrastructure ---------------------------
-    static volatile int passed = 0, failed = 0;
-    static void pass() { passed++; }
-    static void fail() { failed++; Thread.dumpStack(); }
-    static void fail(String msg) { System.out.println(msg); fail(); }
-    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
-    static void check(boolean cond) { if (cond) pass(); else fail(); }
-    static void equal(Object x, Object y) {
-        if (x == null ? y == null : x.equals(y)) pass();
-        else {System.out.println(x + " not equal to " + y); fail();}}
-    static void equal2(Object x, Object y) {equal(x, y); equal(y, x);}
-    public static void main(String[] args) throws Throwable {
-        try { realMain(args); } catch (Throwable t) { unexpected(t); }
-
-        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
-        if (failed > 0) throw new Exception("Some tests failed");
-    }
-    private static abstract class Fun {abstract void f() throws Throwable;}
-    private static void THROWS(Class<? extends Throwable> k, Fun... fs) {
-          for (Fun f : fs)
-              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
-              catch (Throwable t) {
-                  if (k.isAssignableFrom(t.getClass())) pass();
-                  else unexpected(t);}}
-    static byte[] serializedForm(Object obj) {
-        try {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            new ObjectOutputStream(baos).writeObject(obj);
-            return baos.toByteArray();
-        } catch (IOException e) { throw new Error(e); }}
-    static Object readObject(byte[] bytes)
-        throws IOException, ClassNotFoundException {
-        InputStream is = new ByteArrayInputStream(bytes);
-        return new ObjectInputStream(is).readObject();}
-    @SuppressWarnings("unchecked")
-    static <T> T serialClone(T obj) {
-        try { return (T) readObject(serializedForm(obj)); }
-        catch (Exception e) { throw new Error(e); }}
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/charset/StandardCharsets/Standard.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2011, 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 4884238
+ * @summary Test standard charset name constants.
+ * @author Mike Duigou
+ * @run main Standard
+ */
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.io.*;
+import java.nio.charset.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class Standard {
+
+    private final static String standardCharsets[] = {
+        "US-ASCII", "ISO-8859-1", "UTF-8",
+        "UTF-16BE", "UTF-16LE", "UTF-16" };
+
+    public static void realMain(String[] args) {
+        check(StandardCharsets.US_ASCII instanceof Charset);
+        check(StandardCharsets.ISO_8859_1 instanceof Charset);
+        check(StandardCharsets.UTF_8 instanceof Charset);
+        check(StandardCharsets.UTF_16BE instanceof Charset);
+        check(StandardCharsets.UTF_16LE instanceof Charset);
+        check(StandardCharsets.UTF_16 instanceof Charset);
+
+        check("US-ASCII".equals(StandardCharsets.US_ASCII.name()));
+        check("ISO-8859-1".equals(StandardCharsets.ISO_8859_1.name()));
+        check("UTF-8".equals(StandardCharsets.UTF_8.name()));
+        check("UTF-16BE".equals(StandardCharsets.UTF_16BE.name()));
+        check("UTF-16LE".equals(StandardCharsets.UTF_16LE.name()));
+        check("UTF-16".equals(StandardCharsets.UTF_16.name()));
+
+        Set<String> charsets = new HashSet<>();
+        Field standardCharsetFields[] = StandardCharsets.class.getFields();
+
+        for(Field charsetField : standardCharsetFields) {
+            check(StandardCharsets.class == charsetField.getDeclaringClass());
+            check(Modifier.isFinal(charsetField.getModifiers()));
+            check(Modifier.isStatic(charsetField.getModifiers()));
+            check(Modifier.isPublic(charsetField.getModifiers()));
+            Object value;
+            try {
+                value = charsetField.get(null);
+            } catch(IllegalAccessException failure) {
+                unexpected(failure);
+                continue;
+            }
+            check(value instanceof Charset);
+            charsets.add(((Charset)value).name());
+        }
+
+        check(charsets.containsAll(Arrays.asList(standardCharsets)));
+        charsets.removeAll(Arrays.asList(standardCharsets));
+        check(charsets.isEmpty());
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() { passed++; }
+    static void fail() { failed++; Thread.dumpStack(); }
+    static void fail(String msg) { System.out.println(msg); fail(); }
+    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
+    static void check(boolean cond) { if (cond) pass(); else fail(); }
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else {System.out.println(x + " not equal to " + y); fail();}}
+    static void equal2(Object x, Object y) {equal(x, y); equal(y, x);}
+    public static void main(String[] args) throws Throwable {
+        try { realMain(args); } catch (Throwable t) { unexpected(t); }
+
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new Exception("Some tests failed");
+    }
+    private static abstract class Fun {abstract void f() throws Throwable;}
+    private static void THROWS(Class<? extends Throwable> k, Fun... fs) {
+          for (Fun f : fs)
+              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
+              catch (Throwable t) {
+                  if (k.isAssignableFrom(t.getClass())) pass();
+                  else unexpected(t);}}
+    static byte[] serializedForm(Object obj) {
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            new ObjectOutputStream(baos).writeObject(obj);
+            return baos.toByteArray();
+        } catch (IOException e) { throw new Error(e); }}
+    static Object readObject(byte[] bytes)
+        throws IOException, ClassNotFoundException {
+        InputStream is = new ByteArrayInputStream(bytes);
+        return new ObjectInputStream(is).readObject();}
+    @SuppressWarnings("unchecked")
+    static <T> T serialClone(T obj) {
+        try { return (T) readObject(serializedForm(obj)); }
+        catch (Exception e) { throw new Error(e); }}
+
+}
--- a/jdk/test/java/nio/file/Files/CheckPermissions.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/file/Files/CheckPermissions.java	Mon May 16 18:19:34 2011 -0700
@@ -540,7 +540,7 @@
 
             try (WatchService watcher = FileSystems.getDefault().newWatchService()) {
                 prepare();
-                testdir.register(watcher, StandardWatchEventKind.ENTRY_DELETE);
+                testdir.register(watcher, StandardWatchEventKinds.ENTRY_DELETE);
                 assertCheckRead(testdir);
             }
 
--- a/jdk/test/java/nio/file/WatchService/Basic.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/file/WatchService/Basic.java	Mon May 16 18:19:34 2011 -0700
@@ -29,7 +29,7 @@
  */
 
 import java.nio.file.*;
-import static java.nio.file.StandardWatchEventKind.*;
+import static java.nio.file.StandardWatchEventKinds.*;
 import java.nio.file.attribute.*;
 import java.io.*;
 import java.util.*;
@@ -100,7 +100,7 @@
             // remove key and check that we got the ENTRY_CREATE event
             takeExpectedKey(watcher, myKey);
             checkExpectedEvent(myKey.pollEvents(),
-                StandardWatchEventKind.ENTRY_CREATE, name);
+                StandardWatchEventKinds.ENTRY_CREATE, name);
 
             System.out.println("reset key");
             if (!myKey.reset())
@@ -121,7 +121,7 @@
             Files.delete(file);
             takeExpectedKey(watcher, myKey);
             checkExpectedEvent(myKey.pollEvents(),
-                StandardWatchEventKind.ENTRY_DELETE, name);
+                StandardWatchEventKinds.ENTRY_DELETE, name);
 
             System.out.println("reset key");
             if (!myKey.reset())
@@ -149,7 +149,7 @@
             // remove key and check that we got the ENTRY_MODIFY event
             takeExpectedKey(watcher, myKey);
             checkExpectedEvent(myKey.pollEvents(),
-                StandardWatchEventKind.ENTRY_MODIFY, name);
+                StandardWatchEventKinds.ENTRY_MODIFY, name);
             System.out.println("OKAY");
 
             // done
@@ -424,7 +424,7 @@
             // check that key1 got ENTRY_CREATE
             takeExpectedKey(watcher1, key1);
             checkExpectedEvent(key1.pollEvents(),
-                StandardWatchEventKind.ENTRY_CREATE, name2);
+                StandardWatchEventKinds.ENTRY_CREATE, name2);
 
             // check that key2 got zero events
             WatchKey key = watcher2.poll();
@@ -437,7 +437,7 @@
             // check that key2 got ENTRY_DELETE
             takeExpectedKey(watcher2, key2);
             checkExpectedEvent(key2.pollEvents(),
-                StandardWatchEventKind.ENTRY_DELETE, name1);
+                StandardWatchEventKinds.ENTRY_DELETE, name1);
 
             // check that key1 got zero events
             key = watcher1.poll();
@@ -458,7 +458,7 @@
             Files.createFile(file1);
             takeExpectedKey(watcher2, key2);
             checkExpectedEvent(key2.pollEvents(),
-                StandardWatchEventKind.ENTRY_CREATE, name1);
+                StandardWatchEventKinds.ENTRY_CREATE, name1);
 
             System.out.println("OKAY");
 
--- a/jdk/test/java/nio/file/WatchService/FileTreeModifier.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/file/WatchService/FileTreeModifier.java	Mon May 16 18:19:34 2011 -0700
@@ -28,7 +28,7 @@
  */
 
 import java.nio.file.*;
-import static java.nio.file.StandardWatchEventKind.*;
+import static java.nio.file.StandardWatchEventKinds.*;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.*;
--- a/jdk/test/java/nio/file/WatchService/LotsOfEvents.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/file/WatchService/LotsOfEvents.java	Mon May 16 18:19:34 2011 -0700
@@ -29,7 +29,7 @@
  */
 
 import java.nio.file.*;
-import static java.nio.file.StandardWatchEventKind.*;
+import static java.nio.file.StandardWatchEventKinds.*;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.*;
--- a/jdk/test/java/nio/file/WatchService/SensitivityModifier.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/file/WatchService/SensitivityModifier.java	Mon May 16 18:19:34 2011 -0700
@@ -29,7 +29,7 @@
  */
 
 import java.nio.file.*;
-import static java.nio.file.StandardWatchEventKind.*;
+import static java.nio.file.StandardWatchEventKinds.*;
 import java.io.OutputStream;
 import java.io.IOException;
 import java.util.Random;
--- a/jdk/test/java/nio/file/WatchService/WithSecurityManager.java	Mon May 16 18:17:26 2011 -0700
+++ b/jdk/test/java/nio/file/WatchService/WithSecurityManager.java	Mon May 16 18:19:34 2011 -0700
@@ -66,7 +66,7 @@
         // attempt to register directory
         try {
             dir.register(dir.getFileSystem().newWatchService(),
-                         new WatchEvent.Kind<?>[]{ StandardWatchEventKind.ENTRY_CREATE },
+                         new WatchEvent.Kind<?>[]{ StandardWatchEventKinds.ENTRY_CREATE },
                          modifiers);
             if (expectedToFail)
                 throw new RuntimeException("SecurityException not thrown");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LoggingDeadlock3.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011, 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     6487638 7041595
+ * @summary Calling LogManager.addLogger() and Logger.getLogger() cause deadlock
+ * @author  Serguei Spitsyn
+ * @build LoggingDeadlock3
+ * @run main/timeout=15 LoggingDeadlock3
+ */
+
+import java.io.*;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+public class LoggingDeadlock3 {
+  static final int         ITER_CNT   = 50000;
+  static final String      MSG_PASSED = "LoggingDeadlock3: passed";
+  static final LogManager  logMgr     = LogManager.getLogManager();
+  static final PrintStream out        = System.out;
+
+  public static void main(String args[]) throws Exception {
+    String tstSrc = System.getProperty("test.src");
+    File   fname  = new File(tstSrc, "LoggingDeadlock3.props");
+    String prop   = fname.getCanonicalPath();
+    System.setProperty("java.util.logging.config.file", prop);
+    logMgr.readConfiguration();
+
+    Thread t1 = new Thread(new AddLogger());
+    Thread t2 = new Thread(new GetLogger());
+    t1.start(); t2.start();
+    t1.join();  t2.join();
+    out.println("\n" + MSG_PASSED);
+  }
+
+  public static class MyLogger extends Logger {
+    protected MyLogger(String name) { super(name, null); }
+  }
+
+  public static class GetLogger implements Runnable {
+    public void run() {
+      for (int cnt = 0; cnt < ITER_CNT * 8; cnt++) {
+        Logger logger = Logger.getLogger("com.sun.Hello"+cnt/10);
+        if (cnt % 1000  == 0) out.print("1");
+        if (cnt % 10000 == 0) out.println();
+      }
+    }
+  }
+
+  public static class AddLogger implements Runnable {
+    public void run() {
+      for (int cnt = 0; cnt < ITER_CNT; cnt++) {
+        Logger addLogger = new MyLogger("com.sun.Hello"+cnt);
+        logMgr.addLogger(addLogger);
+        if (cnt % 100  == 0) out.print("2");
+        if (cnt % 1000 == 0) out.println();
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LoggingDeadlock3.props	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,3 @@
+com.sun.LEVEL=FINE
+com.sun.level=FINE
+com.sun.Hello.level=INFO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LoggingDeadlock4.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2011, 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     6977677
+ * @summary Deadlock between LogManager.<clinit> and Logger.getLogger()
+ * @author  Daniel D. Daugherty
+ * @build LoggingDeadlock4
+ * @run main/timeout=15 LoggingDeadlock4
+ */
+
+import java.awt.Container;
+import java.util.concurrent.CountDownLatch;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+public class LoggingDeadlock4 {
+    private static CountDownLatch barrier      = new CountDownLatch(1);
+    private static CountDownLatch lmIsRunning  = new CountDownLatch(1);
+    private static CountDownLatch logIsRunning = new CountDownLatch(1);
+
+    public static void main(String[] args) {
+        System.out.println("main: LoggingDeadlock4 is starting.");
+
+        // Loading the java.awt.Container class will create a
+        // sun.util.logging.PlatformLogger$JavaLogger object
+        // that has to be redirected when the LogManager class
+        // is initialized. This can cause a deadlock between
+        // LogManager.<clinit> and Logger.getLogger().
+        try {
+            Class.forName("java.awt.Container");
+        } catch (ClassNotFoundException cnfe) {
+            throw new RuntimeException("Test failed: could not load"
+                + " java.awt.Container." + cnfe);
+        }
+
+        Thread lmThread = new Thread("LogManagerThread") {
+            public void run() {
+                // let main know LogManagerThread is running
+                lmIsRunning.countDown();
+
+                System.out.println(Thread.currentThread().getName()
+                    + ": is running.");
+
+                try {
+                    barrier.await();  // wait for race to start
+                } catch (InterruptedException e) {
+                }
+
+                LogManager manager = LogManager.getLogManager();
+            }
+        };
+        lmThread.start();
+
+        Thread logThread = new Thread("LoggerThread") {
+            public void run() {
+                // let main know LoggerThread is running
+                logIsRunning.countDown();
+
+                System.out.println(Thread.currentThread().getName()
+                    + ": is running.");
+
+                try {
+                    barrier.await();  // wait for race to start
+                } catch (InterruptedException e) {
+                }
+
+                Logger foo = Logger.getLogger("foo logger");
+            }
+        };
+        logThread.start();
+
+        try {
+            // wait for LogManagerThread and LoggerThread to get going
+            lmIsRunning.await();
+            logIsRunning.await();
+        } catch (InterruptedException e) {
+        }
+
+        barrier.countDown();  // start the race
+
+        try {
+            lmThread.join();
+            logThread.join();
+        } catch (InterruptedException ie) {
+        }
+
+        System.out.println("main: LoggingDeadlock4 is done.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/timer/StartTest.java	Mon May 16 18:19:34 2011 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2008, 2011, 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 6659215
+ * @summary Test on timer start method with past notifications
+ * @author Shanliang JIANG
+ * @run clean StartTest
+ * @run build StartTest
+ * @run main StartTest
+ */
+
+import java.util.Date;
+import javax.management.timer.Timer;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+
+public class StartTest {
+    public static void main(String[] args) throws Exception {
+        System.out.println(
+            ">>> Test on timer start method with past notifications.");
+
+        System.out.println(">>> Create a Timer object.");
+        Timer timer = new Timer();
+
+        System.out.println(
+            ">>> Set the flag (setSendPastNotification) to true.");
+        timer.setSendPastNotifications(true);
+
+        timer.addNotificationListener(myListener, null, null);
+
+        System.out.println(">>> Add notifications: " + SENT);
+
+        Date date = new Date();
+        for (int i = 0; i < SENT; i++) {
+            timer.addNotification(
+                "testType" + i, "testMsg" + i, "testData" + i, date);
+        }
+
+        System.out.println(">>> The notifications should be sent at " + date);
+        System.out.println(">>> Sleep 100 ms to have past notifications.");
+        Thread.sleep(100);
+
+        System.out.println(">>> Start the timer at " + new Date());
+        timer.start();
+
+        System.out.println(">>> Stop the timer.");
+        Thread.sleep(100);
+        stopping = true;
+        timer.stop();
+
+        if (received != SENT) {
+            throw new RuntimeException(
+                "Expected to receive " + SENT + " but got " + received);
+        }
+
+        System.out.println(">>> Received all expected notifications.");
+
+        System.out.println(">>> Bye bye!");
+    }
+
+    private static NotificationListener myListener =
+        new NotificationListener() {
+            public void handleNotification(Notification n, Object hb) {
+                if (!stopping) {
+                    received++;
+                    System.out.println(
+                        ">>> myListener-handleNotification: received " +
+                        n.getSequenceNumber());
+            }
+        }
+    };
+
+    private static int SENT = 10;
+    private static volatile int received = 0;
+    private static volatile boolean stopping = false;
+}