Merge
authorprr
Fri, 29 Apr 2016 11:54:18 -0700
changeset 38392 d10be4336930
parent 38391 7e1487f1b7dc (current diff)
parent 37717 31a7a0b5ade3 (diff)
child 38393 2e49e69f3d64
Merge
jdk/make/launcher/Launcher-jdk.jvmstat.rmi.gmk
jdk/src/java.base/share/classes/jdk/net/ExtendedSocketOptions.java
jdk/src/java.base/share/classes/jdk/net/NetworkPermission.java
jdk/src/java.base/share/classes/jdk/net/SocketFlow.java
jdk/src/java.base/share/classes/jdk/net/Sockets.java
jdk/src/java.base/share/classes/jdk/net/package-info.java
jdk/src/java.base/share/classes/sun/net/ExtendedOptionsImpl.java
jdk/src/java.base/share/classes/sun/security/action/GetBooleanSecurityPropertyAction.java
jdk/src/java.base/unix/native/libnet/ExtendedOptionsImpl.c
jdk/src/java.base/windows/native/libnet/ExtendedOptionsImpl.c
jdk/src/jdk.jvmstat.rmi/share/classes/module-info.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteHost.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/package.html
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/PerfDataBuffer.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteVmManager.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/package.html
jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/Jstatd.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/RemoteHostImpl.java
jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/RemoteVmImpl.java
jdk/test/sanity/client/lib/Jemmy2Ext/src/org/jemmy2ext/JemmyExt.java
--- a/jdk/.hgtags	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/.hgtags	Fri Apr 29 11:54:18 2016 -0700
@@ -358,3 +358,4 @@
 68f8be44b6a6b33dfa841ec671c0ba6e4056b372 jdk-9+113
 bb8379287f3736f38c52b2d1418784e2592461d1 jdk-9+114
 35225b837d66582037eeadeb471c13235dfd793d jdk-9+115
+baeb5edb38939cdb78ae0ac6f4fd368465cbf188 jdk-9+116
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/launcher/Launcher-jdk.jstatd.gmk	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2011, 2015, 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.
+#
+
+include LauncherCommon.gmk
+
+$(eval $(call SetupBuildLauncher, jstatd, \
+    MAIN_CLASS := sun.tools.jstatd.Jstatd, \
+))
--- a/jdk/make/launcher/Launcher-jdk.jvmstat.rmi.gmk	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 2011, 2015, 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.
-#
-
-include LauncherCommon.gmk
-
-$(eval $(call SetupBuildLauncher, jstatd, \
-    MAIN_CLASS := sun.tools.jstatd.Jstatd, \
-))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/lib/Lib-jdk.net.gmk	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2016, 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.
+#
+
+include LibCommon.gmk
+
+################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+
+  $(eval $(call SetupNativeCompilation, BUILD_LIBEXTNET, \
+      LIBRARY := extnet, \
+      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+      SRC := $(JDK_TOPDIR)/src/jdk.net/solaris/native/libextnet, \
+      OPTIMIZATION := LOW, \
+      CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
+      MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libextnet/mapfile-vers, \
+      LDFLAGS := $(LDFLAGS_JDKLIB) \
+          $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LIBS := -lsocket -lc -ljava, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libextnet, \
+  ))
+
+  $(BUILD_LIBEXTNET): $(call FindLib, java.base, java)
+
+  TARGETS += $(BUILD_LIBEXTNET)
+endif
+
+
+################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mapfiles/libextnet/mapfile-vers	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2016, 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.
+#
+
+SUNWprivate_1.1 {
+	global:
+	    Java_jdk_net_SolarisSocketOptions_init;
+	    Java_jdk_net_SolarisSocketOptions_setFlowOption;
+	    Java_jdk_net_SolarisSocketOptions_getFlowOption;
+	    Java_jdk_net_SolarisSocketOptions_flowSupported;
+	local:
+	    *;
+};
--- a/jdk/make/mapfiles/libnet/mapfile-vers	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/make/mapfiles/libnet/mapfile-vers	Fri Apr 29 11:54:18 2016 -0700
@@ -98,10 +98,6 @@
 		Java_sun_net_sdp_SdpSupport_create0;
 		Java_sun_net_spi_DefaultProxySelector_init;
 		Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
-		Java_sun_net_ExtendedOptionsImpl_init;
-		Java_sun_net_ExtendedOptionsImpl_setFlowOption;
-		Java_sun_net_ExtendedOptionsImpl_getFlowOption;
-		Java_sun_net_ExtendedOptionsImpl_flowSupported;
 		NET_AllocSockaddr;
 		NET_SockaddrToInetAddress;
                 NET_SockaddrEqualsInetAddress;
--- a/jdk/make/netbeans/client_sanity/nbproject/genfiles.properties	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/make/netbeans/client_sanity/nbproject/genfiles.properties	Fri Apr 29 11:54:18 2016 -0700
@@ -3,6 +3,6 @@
 build.xml.stylesheet.CRC32=8064a381@1.75.2.48
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=55414227
+nbproject/build-impl.xml.data.CRC32=16caf60f
 nbproject/build-impl.xml.script.CRC32=c12f9d04
 nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
--- a/jdk/make/netbeans/client_sanity/nbproject/project.properties	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/make/netbeans/client_sanity/nbproject/project.properties	Fri Apr 29 11:54:18 2016 -0700
@@ -76,4 +76,4 @@
 src.src.dir=..\\..\\..\\test\\sanity\\client\\SwingSet\\src
 src.src2.dir=..\\..\\..\\test\\sanity\\client\\lib\\SwingSet3\\src
 src.src3.dir=..\\..\\..\\test\\sanity\\client\\lib\\jemmy\\src
-src.src4.dir=..\\..\\..\\test\\sanity\\client\\lib\\Jemmy2Ext\\src
+src.src4.dir=..\\..\\..\\test\\sanity\\client\\lib\\Extensions\\src
--- a/jdk/make/netbeans/client_sanity/nbproject/project.xml	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/make/netbeans/client_sanity/nbproject/project.xml	Fri Apr 29 11:54:18 2016 -0700
@@ -6,7 +6,7 @@
             <name>SanityTests</name>
             <source-roots>
                 <root id="src.src3.dir" name="lib\jemmy\src"/>
-                <root id="src.src4.dir" name="lib\Jemmy2Ext\src"/>
+                <root id="src.src4.dir" name="lib\Extensions\src"/>
                 <root id="src.src2.dir" name="lib\SwingSet3\src"/>
                 <root id="src.src.dir" name="SwingSet\src"/>
             </source-roots>
--- a/jdk/make/src/classes/build/tools/module/GenModuleInfoSource.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/make/src/classes/build/tools/module/GenModuleInfoSource.java	Fri Apr 29 11:54:18 2016 -0700
@@ -52,7 +52,7 @@
         "Usage: GenModuleInfoSource [option] -o <output file> <module-info-java>\n" +
         "Options are:\n" +
         "  -exports  <package-name>\n" +
-        "  -exports  <package-name>/<module-name>\n" +
+        "  -exports  <package-name>[/<module-name>]\n" +
         "  -uses     <service>\n" +
         "  -provides <service>/<provider-impl-classname>\n";
 
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1155,8 +1155,9 @@
          * @param level the log message level.
          * @param msg the string message (or a key in the message catalog, if
          * this logger is a {@link
-         * LoggerFinder#getLocalizedLogger(java.lang.String, java.util.ResourceBundle, java.lang.Class)
-         * localized logger}); can be {@code null}.
+         * LoggerFinder#getLocalizedLogger(java.lang.String,
+         * java.util.ResourceBundle, java.lang.reflect.Module) localized logger});
+         * can be {@code null}.
          *
          * @throws NullPointerException if {@code level} is {@code null}.
          */
@@ -1222,8 +1223,9 @@
          * @param level the log message level.
          * @param msg the string message (or a key in the message catalog, if
          * this logger is a {@link
-         * LoggerFinder#getLocalizedLogger(java.lang.String, java.util.ResourceBundle, java.lang.Class)
-         * localized logger}); can be {@code null}.
+         * LoggerFinder#getLocalizedLogger(java.lang.String,
+         * java.util.ResourceBundle, java.lang.reflect.Module) localized logger});
+         * can be {@code null}.
          * @param thrown a {@code Throwable} associated with the log message;
          *        can be {@code null}.
          *
@@ -1270,8 +1272,9 @@
          * @param format the string message format in {@link
          * java.text.MessageFormat} format, (or a key in the message
          * catalog, if this logger is a {@link
-         * LoggerFinder#getLocalizedLogger(java.lang.String, java.util.ResourceBundle, java.lang.Class)
-         * localized logger}); can be {@code null}.
+         * LoggerFinder#getLocalizedLogger(java.lang.String,
+         * java.util.ResourceBundle, java.lang.reflect.Module) localized logger});
+         * can be {@code null}.
          * @param params an optional list of parameters to the message (may be
          * none).
          *
@@ -1453,30 +1456,30 @@
 
         /**
          * Returns an instance of {@link Logger Logger}
-         * for the given {@code caller}.
+         * for the given {@code module}.
          *
          * @param name the name of the logger.
-         * @param caller the class for which the logger is being requested.
+         * @param module the module for which the logger is being requested.
          *
-         * @return a {@link Logger logger} suitable for the given caller's
-         *         use.
+         * @return a {@link Logger logger} suitable for use within the given
+         *         module.
          * @throws NullPointerException if {@code name} is {@code null} or
-         *        {@code caller} is {@code null}.
+         *        {@code module} is {@code null}.
          * @throws SecurityException if a security manager is present and its
          *         {@code checkPermission} method doesn't allow the
          *         {@code RuntimePermission("loggerFinder")}.
          */
-        public abstract Logger getLogger(String name, /* Module */ Class<?> caller);
+        public abstract Logger getLogger(String name, Module module);
 
         /**
          * Returns a localizable instance of {@link Logger Logger}
-         * for the given {@code caller}.
+         * for the given {@code module}.
          * The returned logger will use the provided resource bundle for
          * message localization.
          *
          * @implSpec By default, this method calls {@link
-         * #getLogger(java.lang.String, java.lang.Class)
-         * this.getLogger(name, caller)} to obtain a logger, then wraps that
+         * #getLogger(java.lang.String, java.lang.reflect.Module)
+         * this.getLogger(name, module)} to obtain a logger, then wraps that
          * logger in a {@link Logger} instance where all methods that do not
          * take a {@link ResourceBundle} as parameter are redirected to one
          * which does - passing the given {@code bundle} for
@@ -1499,19 +1502,19 @@
          *
          * @param name    the name of the logger.
          * @param bundle  a resource bundle; can be {@code null}.
-         * @param caller the class for which the logger is being requested.
+         * @param module  the module for which the logger is being requested.
          * @return an instance of {@link Logger Logger}  which will use the
          * provided resource bundle for message localization.
          *
          * @throws NullPointerException if {@code name} is {@code null} or
-         *         {@code caller} is {@code null}.
+         *         {@code module} is {@code null}.
          * @throws SecurityException if a security manager is present and its
          *         {@code checkPermission} method doesn't allow the
          *         {@code RuntimePermission("loggerFinder")}.
          */
         public Logger getLocalizedLogger(String name, ResourceBundle bundle,
-                                          /* Module */ Class<?> caller) {
-            return new LocalizedLoggerWrapper<>(getLogger(name, caller), bundle);
+                                         Module module) {
+            return new LocalizedLoggerWrapper<>(getLogger(name, module), bundle);
         }
 
         /**
@@ -1558,12 +1561,13 @@
      *
      * @implSpec
      * Instances returned by this method route messages to loggers
-     * obtained by calling {@link LoggerFinder#getLogger(java.lang.String, java.lang.Class)
-     * LoggerFinder.getLogger(name, caller)}.
+     * obtained by calling {@link LoggerFinder#getLogger(java.lang.String,
+     * java.lang.reflect.Module) LoggerFinder.getLogger(name, module)}, where
+     * {@code module} is the caller's module.
      *
      * @apiNote
      * This method may defer calling the {@link
-     * LoggerFinder#getLogger(java.lang.String, java.lang.Class)
+     * LoggerFinder#getLogger(java.lang.String, java.lang.reflect.Module)
      * LoggerFinder.getLogger} method to create an actual logger supplied by
      * the logging backend, for instance, to allow loggers to be obtained during
      * the system initialization time.
@@ -1579,7 +1583,7 @@
     public static Logger getLogger(String name) {
         Objects.requireNonNull(name);
         final Class<?> caller = Reflection.getCallerClass();
-        return LazyLoggers.getLogger(name, caller);
+        return LazyLoggers.getLogger(name, caller.getModule());
     }
 
     /**
@@ -1591,8 +1595,9 @@
      * @implSpec
      * The returned logger will perform message localization as specified
      * by {@link LoggerFinder#getLocalizedLogger(java.lang.String,
-     * java.util.ResourceBundle, java.lang.Class)
-     * LoggerFinder.getLocalizedLogger(name, bundle, caller}.
+     * java.util.ResourceBundle, java.lang.reflect.Module)
+     * LoggerFinder.getLocalizedLogger(name, bundle, module}, where
+     * {@code module} is the caller's module.
      *
      * @apiNote
      * This method is intended to be used after the system is fully initialized.
@@ -1624,12 +1629,14 @@
         // Bootstrap sensitive classes in the JDK do not use resource bundles
         // when logging. This could be revisited later, if it needs to.
         if (sm != null) {
-            return AccessController.doPrivileged((PrivilegedAction<Logger>)
-                    () -> LoggerFinder.accessProvider().getLocalizedLogger(name, rb, caller),
-                    null,
-                    LoggerFinder.LOGGERFINDER_PERMISSION);
+            final PrivilegedAction<Logger> pa =
+                    () -> LoggerFinder.accessProvider()
+                            .getLocalizedLogger(name, rb, caller.getModule());
+            return AccessController.doPrivileged(pa, null,
+                                         LoggerFinder.LOGGERFINDER_PERMISSION);
         }
-        return LoggerFinder.accessProvider().getLocalizedLogger(name, rb, caller);
+        return LoggerFinder.accessProvider()
+                .getLocalizedLogger(name, rb, caller.getModule());
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import java.lang.reflect.Array;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Arrays;
@@ -1892,7 +1893,8 @@
             MH_tryFinallyExec        = 12,
             MH_tryFinallyVoidExec    = 13,
             MH_decrementCounter      = 14,
-            MH_LIMIT                 = 15;
+            MH_Array_newInstance     = 15,
+            MH_LIMIT                 = 16;
 
     static MethodHandle getConstantHandle(int idx) {
         MethodHandle handle = HANDLES[idx];
@@ -1965,6 +1967,9 @@
                 case MH_decrementCounter:
                     return IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "decrementCounter",
                             MethodType.methodType(int.class, int.class));
+                case MH_Array_newInstance:
+                    return IMPL_LOOKUP.findStatic(Array.class, "newInstance",
+                            MethodType.methodType(Object.class, Class.class, int.class));
             }
         } catch (ReflectiveOperationException ex) {
             throw newInternalError(ex);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Apr 29 11:54:18 2016 -0700
@@ -25,34 +25,38 @@
 
 package java.lang.invoke;
 
-import java.lang.reflect.*;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.reflect.CallerSensitive;
+import jdk.internal.reflect.Reflection;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyAccess;
+import sun.invoke.util.Wrapper;
+import sun.reflect.misc.ReflectUtil;
+import sun.security.util.SecurityConstants;
+
+import java.lang.invoke.LambdaForm.BasicType;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ReflectPermission;
+import java.nio.ByteOrder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.BitSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Arrays;
 import java.util.Objects;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.VerifyAccess;
-import sun.invoke.util.Wrapper;
-import jdk.internal.reflect.CallerSensitive;
-import jdk.internal.reflect.Reflection;
-import sun.reflect.misc.ReflectUtil;
-import sun.security.util.SecurityConstants;
-import java.lang.invoke.LambdaForm.BasicType;
-
-import static java.lang.invoke.MethodHandleImpl.Intrinsic;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Opcodes;
-
+import static java.lang.invoke.MethodHandleImpl.Intrinsic;
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.newIllegalArgumentException;
 import static java.lang.invoke.MethodType.methodType;
 
@@ -741,10 +745,13 @@
             if (name.startsWith("java.lang.invoke."))
                 throw newIllegalArgumentException("illegal lookupClass: "+lookupClass);
 
-            // For caller-sensitive MethodHandles.lookup()
-            // disallow lookup more restricted packages
+            // For caller-sensitive MethodHandles.lookup() disallow lookup from
+            // restricted packages.  This a fragile and blunt approach.
+            // TODO replace with a more formal and less fragile mechanism
+            // that does not bluntly restrict classes under packages within
+            // java.base from looking up MethodHandles or VarHandles.
             if (allowedModes == ALL_MODES && lookupClass.getClassLoader() == null) {
-                if (name.startsWith("java.") ||
+                if ((name.startsWith("java.") && !name.startsWith("java.util.concurrent.")) ||
                         (name.startsWith("sun.") && !name.startsWith("sun.invoke."))) {
                     throw newIllegalArgumentException("illegal lookupClass: " + lookupClass);
                 }
@@ -1003,6 +1010,9 @@
          * @throws NullPointerException if any argument is null
          */
         public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuchMethodException, IllegalAccessException {
+            if (refc.isArray()) {
+                throw new NoSuchMethodException("no constructor for array class: " + refc.getName());
+            }
             String name = "<init>";
             MemberName ctor = resolveOrFail(REF_newInvokeSpecial, refc, name, type);
             return getDirectConstructor(refc, ctor);
@@ -2214,6 +2224,27 @@
     }
 
     /**
+     * Produces a method handle constructing arrays of a desired type.
+     * The return type of the method handle will be the array type.
+     * The type of its sole argument will be {@code int}, which specifies the size of the array.
+     * @param arrayClass an array type
+     * @return a method handle which can create arrays of the given type
+     * @throws NullPointerException if the argument is {@code null}
+     * @throws IllegalArgumentException if {@code arrayClass} is not an array type
+     * @see java.lang.reflect.Array#newInstance(Class, int)
+     * @since 9
+     */
+    public static
+    MethodHandle arrayConstructor(Class<?> arrayClass) throws IllegalArgumentException {
+        if (!arrayClass.isArray()) {
+            throw newIllegalArgumentException("not an array class: " + arrayClass.getName());
+        }
+        MethodHandle ani = MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_Array_newInstance).
+                bindTo(arrayClass.getComponentType());
+        return ani.asType(ani.type().changeReturnType(arrayClass));
+    }
+
+    /**
      * Produces a method handle giving read access to elements of an array.
      * The type of the method handle will have a return type of the array's
      * element type.  Its first argument will be the array type,
@@ -2337,13 +2368,12 @@
      *
      * @param viewArrayClass the view array class, with a component type of
      * type {@code T}
-     * @param bigEndian true if the endianness of the view array elements, as
-     * stored in the underlying {@code byte} array, is big endian, otherwise
-     * little endian
+     * @param byteOrder the endianness of the view array elements, as
+     * stored in the underlying {@code byte} array
      * @return a VarHandle giving access to elements of a {@code byte[]} array
      * viewed as if elements corresponding to the components type of the view
      * array class
-     * @throws NullPointerException if viewArrayClass is null
+     * @throws NullPointerException if viewArrayClass or byteOrder is null
      * @throws IllegalArgumentException if viewArrayClass is not an array type
      * @throws UnsupportedOperationException if the component type of
      * viewArrayClass is not supported as a variable type
@@ -2351,8 +2381,10 @@
      */
     public static
     VarHandle byteArrayViewVarHandle(Class<?> viewArrayClass,
-                                     boolean bigEndian) throws IllegalArgumentException {
-        return VarHandles.byteArrayViewHandle(viewArrayClass, bigEndian);
+                                     ByteOrder byteOrder) throws IllegalArgumentException {
+        Objects.requireNonNull(byteOrder);
+        return VarHandles.byteArrayViewHandle(viewArrayClass,
+                                              byteOrder == ByteOrder.BIG_ENDIAN);
     }
 
     /**
@@ -2422,14 +2454,13 @@
      *
      * @param viewArrayClass the view array class, with a component type of
      * type {@code T}
-     * @param bigEndian true if the endianness of the view array elements, as
-     * stored in the underlying {@code ByteBuffer}, is big endian, otherwise
-     * little endian (Note this overrides the endianness of a
-     * {@code ByteBuffer})
+     * @param byteOrder the endianness of the view array elements, as
+     * stored in the underlying {@code ByteBuffer} (Note this overrides the
+     * endianness of a {@code ByteBuffer})
      * @return a VarHandle giving access to elements of a {@code ByteBuffer}
      * viewed as if elements corresponding to the components type of the view
      * array class
-     * @throws NullPointerException if viewArrayClass is null
+     * @throws NullPointerException if viewArrayClass or byteOrder is null
      * @throws IllegalArgumentException if viewArrayClass is not an array type
      * @throws UnsupportedOperationException if the component type of
      * viewArrayClass is not supported as a variable type
@@ -2437,8 +2468,10 @@
      */
     public static
     VarHandle byteBufferViewVarHandle(Class<?> viewArrayClass,
-                                      boolean bigEndian) throws IllegalArgumentException {
-        return VarHandles.makeByteBufferViewHandle(viewArrayClass, bigEndian);
+                                      ByteOrder byteOrder) throws IllegalArgumentException {
+        Objects.requireNonNull(byteOrder);
+        return VarHandles.makeByteBufferViewHandle(viewArrayClass,
+                                                   byteOrder == ByteOrder.BIG_ENDIAN);
     }
 
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Fri Apr 29 11:54:18 2016 -0700
@@ -123,7 +123,7 @@
      * Concatenation strategy to use. See {@link Strategy} for possible options.
      * This option is controllable with -Djava.lang.invoke.stringConcat JDK option.
      */
-    private static final Strategy STRATEGY;
+    private static Strategy STRATEGY;
 
     /**
      * Default strategy to use for concatenation.
@@ -187,6 +187,16 @@
     private static final ProxyClassesDumper DUMPER;
 
     static {
+        // In case we need to double-back onto the StringConcatFactory during this
+        // static initialization, make sure we have the reasonable defaults to complete
+        // the static initialization properly. After that, actual users would use the
+        // the proper values we have read from the the properties.
+        STRATEGY = DEFAULT_STRATEGY;
+        // CACHE_ENABLE = false; // implied
+        // CACHE = null;         // implied
+        // DEBUG = false;        // implied
+        // DUMPER = null;        // implied
+
         Properties props = GetPropertyAction.getProperties();
         final String strategy =
                 props.getProperty("java.lang.invoke.stringConcat");
--- a/jdk/src/java.base/share/classes/java/util/Arrays.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -4403,6 +4403,35 @@
         public void sort(Comparator<? super E> c) {
             Arrays.sort(a, c);
         }
+
+        @Override
+        public Iterator<E> iterator() {
+            return new ArrayItr<>(a);
+        }
+    }
+
+    private static class ArrayItr<E> implements Iterator<E> {
+        private int cursor;
+        private final E[] a;
+
+        ArrayItr(E[] a) {
+            this.a = a;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return cursor < a.length;
+        }
+
+        @Override
+        public E next() {
+            int i = cursor;
+            if (i >= a.length) {
+                throw new NoSuchElementException();
+            }
+            cursor = i + 1;
+            return a[i];
+        }
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/Observable.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Observable.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, 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
@@ -58,7 +58,19 @@
  * @see     java.util.Observer
  * @see     java.util.Observer#update(java.util.Observable, java.lang.Object)
  * @since   1.0
+ *
+ * @deprecated
+ * This class and the {@link Observer} interface have been deprecated.
+ * The event model supported by {@code Observer} and {@code Observable}
+ * is quite limited, the order of notifications delivered by
+ * {@code Observable} is unspecified, and state changes are not in
+ * one-for-one correspondence with notifications.
+ * For a richer event model, consider using the
+ * {@link java.beans} package.  For reliable and ordered
+ * messaging among threads, consider using one of the concurrent data
+ * structures in the {@link java.util.concurrent} package.
  */
+@Deprecated(since="9")
 public class Observable {
     private boolean changed = false;
     private Vector<Observer> obs;
--- a/jdk/src/java.base/share/classes/java/util/Observer.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Observer.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, 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
@@ -31,7 +31,12 @@
  * @author  Chris Warth
  * @see     java.util.Observable
  * @since   1.0
+ *
+ * @deprecated
+ * This interface has been deprecated. See the {@link Observable}
+ * class for further information.
  */
+@Deprecated(since="9")
 public interface Observer {
     /**
      * This method is called whenever the observed object is changed. An
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java	Fri Apr 29 11:54:18 2016 -0700
@@ -33,6 +33,9 @@
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
 import java.lang.ref.ReferenceQueue;
+import java.lang.reflect.Module;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Collection;
 import java.util.ResourceBundle;
 
@@ -129,41 +132,49 @@
             return w;
         }
 
-
         final static SharedLoggers system = new SharedLoggers();
         final static SharedLoggers application = new SharedLoggers();
     }
 
+    public static boolean isSystem(Module m) {
+        ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<>() {
+            @Override
+            public ClassLoader run() {
+                return m.getClassLoader();
+            }
+        });
+        return cl == null;
+    }
+
     @Override
-    public final Logger getLogger(String name,  /* Module */ Class<?> caller) {
+    public final Logger getLogger(String name,  Module module) {
         checkPermission();
-        return demandLoggerFor(name, caller);
+        return demandLoggerFor(name, module);
     }
 
     @Override
     public final Logger getLocalizedLogger(String name, ResourceBundle bundle,
-                                           /* Module */  Class<?> caller) {
-        return super.getLocalizedLogger(name, bundle, caller);
+                                           Module module) {
+        return super.getLocalizedLogger(name, bundle, module);
     }
 
-
-
     /**
-     * Returns a {@link Logger logger} suitable for the caller usage.
+     * Returns a {@link Logger logger} suitable for use within the
+     * given {@code module}.
      *
      * @implSpec The default implementation for this method is to return a
      *    simple logger that will print all messages of INFO level and above
      *    to the console. That simple logger is not configurable.
      *
      * @param name The name of the logger.
-     * @param caller The class on behalf of which the logger is created.
+     * @param module The module on behalf of which the logger is created.
      * @return A {@link Logger logger} suitable for the application usage.
      * @throws SecurityException if the calling code does not have the
      * {@code RuntimePermission("loggerFinder")}.
      */
-    protected Logger demandLoggerFor(String name, /* Module */ Class<?> caller) {
+    protected Logger demandLoggerFor(String name, Module module) {
         checkPermission();
-        if (caller.getClassLoader() == null) {
+        if (isSystem(module)) {
             return SharedLoggers.system.get(SimpleConsoleLogger::makeSimpleLogger, name);
         } else {
             return SharedLoggers.application.get(SimpleConsoleLogger::makeSimpleLogger, name);
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Fri Apr 29 11:54:18 2016 -0700
@@ -31,6 +31,7 @@
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
 import java.lang.ref.WeakReference;
+import java.lang.reflect.Module;
 import java.util.Objects;
 import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
@@ -59,15 +60,15 @@
          * A factory method to create an SPI logger.
          * Usually, this will be something like LazyLoggers::getSystemLogger.
          */
-        final BiFunction<String, Class<?>, L> loggerSupplier;
+        final BiFunction<String, Module, L> loggerSupplier;
 
 
-        public LazyLoggerFactories(BiFunction<String, Class<?>, L> loggerSupplier) {
+        public LazyLoggerFactories(BiFunction<String, Module, L> loggerSupplier) {
             this(Objects.requireNonNull(loggerSupplier),
                  (Void)null);
         }
 
-        private LazyLoggerFactories(BiFunction<String, Class<?>, L> loggerSupplier,
+        private LazyLoggerFactories(BiFunction<String, Module, L> loggerSupplier,
                           Void unused) {
             this.loggerSupplier = loggerSupplier;
         }
@@ -107,8 +108,8 @@
         // The factories that will be used to create the logger lazyly
         final LazyLoggerFactories<? extends Logger> factories;
 
-        // We need to pass the actual caller when creating the logger.
-        private final WeakReference<Class<?>> callerRef;
+        // We need to pass the actual caller module when creating the logger.
+        private final WeakReference<Module> moduleRef;
 
         // The name of the logger that will be created lazyly
         final String name;
@@ -121,17 +122,17 @@
 
         private LazyLoggerAccessor(String name,
                                    LazyLoggerFactories<? extends Logger> factories,
-                                   Class<?> caller) {
+                                   Module module) {
             this(Objects.requireNonNull(name), Objects.requireNonNull(factories),
-                    Objects.requireNonNull(caller), null);
+                    Objects.requireNonNull(module), null);
         }
 
         private LazyLoggerAccessor(String name,
                                    LazyLoggerFactories<? extends Logger> factories,
-                                   Class<?> caller, Void unused) {
+                                   Module module, Void unused) {
             this.name = name;
             this.factories = factories;
-            this.callerRef = new WeakReference<Class<?>>(caller);
+            this.moduleRef = new WeakReference<>(module);
         }
 
         /**
@@ -270,12 +271,12 @@
 
         // Creates the wrapped logger by invoking the SPI.
         Logger createLogger() {
-            final Class<?> caller = callerRef.get();
-            if (caller == null) {
-                throw new IllegalStateException("The class for which this logger"
+            final Module module = moduleRef.get();
+            if (module == null) {
+                throw new IllegalStateException("The module for which this logger"
                         + " was created has been garbage collected");
             }
-            return this.factories.loggerSupplier.apply(name, caller);
+            return this.factories.loggerSupplier.apply(name, module);
         }
 
         /**
@@ -289,8 +290,8 @@
          * @return A new LazyLoggerAccessor.
          */
         public static LazyLoggerAccessor makeAccessor(String name,
-                LazyLoggerFactories<? extends Logger> factories, Class<?> caller) {
-                return new LazyLoggerAccessor(name, factories, caller);
+                LazyLoggerFactories<? extends Logger> factories, Module module) {
+                return new LazyLoggerAccessor(name, factories, module);
         }
 
     }
@@ -346,11 +347,11 @@
 
     // Avoid using lambda here as lazy loggers could be created early
     // in the bootstrap sequence...
-    private static final BiFunction<String, Class<?>, Logger> loggerSupplier =
+    private static final BiFunction<String, Module, Logger> loggerSupplier =
            new BiFunction<>() {
         @Override
-        public Logger apply(String name, Class<?> caller) {
-            return LazyLoggers.getLoggerFromFinder(name, caller);
+        public Logger apply(String name, Module module) {
+            return LazyLoggers.getLoggerFromFinder(name, module);
         }
     };
 
@@ -367,8 +368,8 @@
     // logger provider until the VM has finished booting.
     //
     private static final class JdkLazyLogger extends LazyLoggerWrapper {
-        JdkLazyLogger(String name, Class<?> caller) {
-            this(LazyLoggerAccessor.makeAccessor(name, factories, caller),
+        JdkLazyLogger(String name, Module module) {
+            this(LazyLoggerAccessor.makeAccessor(name, factories, module),
                  (Void)null);
         }
         private JdkLazyLogger(LazyLoggerAccessor holder, Void unused) {
@@ -380,16 +381,16 @@
      * Gets a logger from the LoggerFinder. Creates the actual concrete
      * logger.
      * @param name    name of the logger
-     * @param caller  class on behalf of which the logger is created
+     * @param module  module on behalf of which the logger is created
      * @return  The logger returned by the LoggerFinder.
      */
-    static Logger getLoggerFromFinder(String name, Class<?> caller) {
+    static Logger getLoggerFromFinder(String name, Module module) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm == null) {
-            return accessLoggerFinder().getLogger(name, caller);
+            return accessLoggerFinder().getLogger(name, module);
         } else {
             return AccessController.doPrivileged((PrivilegedAction<Logger>)
-                    () -> {return accessLoggerFinder().getLogger(name, caller);},
+                    () -> {return accessLoggerFinder().getLogger(name, module);},
                     null, LOGGERFINDER_PERMISSION);
         }
     }
@@ -398,22 +399,22 @@
      * Returns a (possibly lazy) Logger for the caller.
      *
      * @param name the logger name
-     * @param caller The class on behalf of which the logger is created.
-     *               If the caller is not loaded from the Boot ClassLoader,
+     * @param module The module on behalf of which the logger is created.
+     *               If the module is not loaded from the Boot ClassLoader,
      *               the LoggerFinder is accessed and the logger returned
-     *               by {@link LoggerFinder#getLogger(java.lang.String, java.lang.Class)}
+     *               by {@link LoggerFinder#getLogger(java.lang.String, java.lang.reflect.Module)}
      *               is returned to the caller directly.
      *               Otherwise, the logger returned by
-     *               {@link #getLazyLogger(java.lang.String, java.lang.Class)}
+     *               {@link #getLazyLogger(java.lang.String, java.lang.reflect.Module)}
      *               is returned to the caller.
      *
      * @return  a (possibly lazy) Logger instance.
      */
-    public static final Logger getLogger(String name, Class<?> caller) {
-        if (caller.getClassLoader() == null) {
-            return getLazyLogger(name, caller);
+    public static final Logger getLogger(String name, Module module) {
+        if (DefaultLoggerFinder.isSystem(module)) {
+            return getLazyLogger(name, module);
         } else {
-            return getLoggerFromFinder(name, caller);
+            return getLoggerFromFinder(name, module);
         }
     }
 
@@ -423,10 +424,10 @@
      * returned by {@link BootstrapLogger#useLazyLoggers()}.
      *
      * @param name the logger name
-     * @param caller the class on behalf of which the logger is created.
+     * @param module the module on behalf of which the logger is created.
      * @return  a (possibly lazy) Logger instance.
      */
-    public static final Logger getLazyLogger(String name, Class<?> caller) {
+    public static final Logger getLazyLogger(String name, Module module) {
 
         // BootstrapLogger has the logic to determine whether a LazyLogger
         // should be used. Usually, it is worth it only if:
@@ -438,10 +439,10 @@
         // configuration, we're not going to delay the creation of loggers...
         final boolean useLazyLogger = BootstrapLogger.useLazyLoggers();
         if (useLazyLogger) {
-            return new JdkLazyLogger(name, caller);
+            return new JdkLazyLogger(name, module);
         } else {
             // Directly invoke the LoggerFinder.
-            return getLoggerFromFinder(name, caller);
+            return getLoggerFromFinder(name, module);
         }
     }
 
--- a/jdk/src/java.base/share/classes/jdk/net/ExtendedSocketOptions.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.net;
-
-import java.net.SocketOption;
-
-/**
- * Defines extended socket options, beyond those defined in
- * {@link java.net.StandardSocketOptions}. These options may be platform
- * specific.
- *
- * @since 1.8
- */
-public final class ExtendedSocketOptions {
-
-    private static class ExtSocketOption<T> implements SocketOption<T> {
-        private final String name;
-        private final Class<T> type;
-        ExtSocketOption(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; }
-    }
-
-    private ExtendedSocketOptions() {}
-
-    /**
-     * Service level properties. When a security manager is installed,
-     * setting or getting this option requires a {@link NetworkPermission}
-     * {@code ("setOption.SO_FLOW_SLA")} or {@code "getOption.SO_FLOW_SLA"}
-     * respectively.
-     */
-    public static final SocketOption<SocketFlow> SO_FLOW_SLA = new
-        ExtSocketOption<SocketFlow>("SO_FLOW_SLA", SocketFlow.class);
-}
--- a/jdk/src/java.base/share/classes/jdk/net/NetworkPermission.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.net;
-
-import java.security.BasicPermission;
-
-/**
- * Represents permission to access the extended networking capabilities
- * defined in the jdk.net package. These permissions contain a target
- * name, but no actions list. Callers either possess the permission or not.
- * <p>
- * The following targets are defined:
- *
- * <table border=1 cellpadding=5 summary="permission target name,
- *  what the target allows,and associated risks">
- * <tr>
- *   <th>Permission Target Name</th>
- *   <th>What the Permission Allows</th>
- *   <th>Risks of Allowing this Permission</th>
- * </tr>
- * <tr>
- *   <td>setOption.SO_FLOW_SLA</td>
- *   <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option
- *       on any socket that supports it</td>
- *   <td>allows caller to set a higher priority or bandwidth allocation
- *       to sockets it creates, than they might otherwise be allowed.</td>
- * </tr>
- * <tr>
- *   <td>getOption.SO_FLOW_SLA</td>
- *   <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA}
- *       setting from any socket that supports the option</td>
- *   <td>allows caller access to SLA information that it might not
- *       otherwise have</td>
- * </tr></table>
- *
- * @see jdk.net.ExtendedSocketOptions
- *
- * @since 1.8
- */
-
-public final class NetworkPermission extends BasicPermission {
-
-    private static final long serialVersionUID = -2012939586906722291L;
-
-    /**
-     * Creates a NetworkPermission with the given target name.
-     *
-     * @param name the permission target name
-     * @throws NullPointerException if {@code name} is {@code null}.
-     * @throws IllegalArgumentException if {@code name} is empty.
-     */
-    public NetworkPermission(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Creates a NetworkPermission with the given target name.
-     *
-     * @param name the permission target name
-     * @param actions should be {@code null}. Is ignored if not.
-     * @throws NullPointerException if {@code name} is {@code null}.
-     * @throws IllegalArgumentException if {@code name} is empty.
-     */
-    public NetworkPermission(String name, String actions)
-    {
-        super(name, actions);
-    }
-}
--- a/jdk/src/java.base/share/classes/jdk/net/SocketFlow.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.net;
-
-import java.lang.annotation.Native;
-
-/**
- * Represents the service level properties for the platform specific socket
- * option {@link ExtendedSocketOptions#SO_FLOW_SLA}.
- * <p>
- * The priority and bandwidth parameters must be set before
- * setting the socket option.
- * <p>
- * When the {@code SO_FLOW_SLA} option is set then it may not take effect
- * immediately. If the value of the socket option is obtained with
- * {@code getOption()} then the status may be returned as {@code INPROGRESS}
- * until it takes effect. The priority and bandwidth values are only valid when
- * the status is returned as OK.
- * <p>
- * When a security manager is installed, a {@link NetworkPermission}
- * is required to set or get this option.
- *
- * @since 1.8
- */
-public class SocketFlow {
-
-    private static final int UNSET = -1;
-    @Native public static final int NORMAL_PRIORITY = 1;
-    @Native public static final int HIGH_PRIORITY = 2;
-
-    private int priority = NORMAL_PRIORITY;
-
-    private long bandwidth = UNSET;
-
-    private Status status = Status.NO_STATUS;
-
-    private SocketFlow() {}
-
-    /**
-     * Enumeration of the return values from the SO_FLOW_SLA
-     * socket option. Both setting and getting the option return
-     * one of these statuses, which reflect the state of socket's
-     * flow.
-     *
-     * @since 1.8
-     */
-    public enum Status {
-        /**
-         * Set or get socket option has not been called yet. Status
-         * values can only be retrieved after calling set or get.
-         */
-        NO_STATUS,
-        /**
-         * Flow successfully created.
-         */
-        OK,
-        /**
-         * Caller has no permission to create flow.
-         */
-        NO_PERMISSION,
-        /**
-         * Flow can not be created because socket is not connected.
-         */
-        NOT_CONNECTED,
-        /**
-         * Flow creation not supported for this socket.
-         */
-        NOT_SUPPORTED,
-        /**
-         * A flow already exists with identical attributes.
-         */
-        ALREADY_CREATED,
-        /**
-         * A flow is being created.
-         */
-        IN_PROGRESS,
-        /**
-         * Some other unspecified error.
-         */
-        OTHER
-    }
-
-    /**
-     * Creates a new SocketFlow that can be used to set the SO_FLOW_SLA
-     * socket option and create a socket flow.
-     */
-    public static SocketFlow create() {
-        return new SocketFlow();
-    }
-
-    /**
-     * Sets this SocketFlow's priority. Must be either NORMAL_PRIORITY
-     * HIGH_PRIORITY. If not set, a flow's priority is normal.
-     *
-     * @throws IllegalArgumentException if priority is not NORMAL_PRIORITY or
-     *         HIGH_PRIORITY.
-     */
-    public SocketFlow priority(int priority) {
-        if (priority != NORMAL_PRIORITY && priority != HIGH_PRIORITY) {
-            throw new IllegalArgumentException("invalid priority");
-        }
-        this.priority = priority;
-        return this;
-    }
-
-    /**
-     * Sets this SocketFlow's bandwidth. Must be greater than or equal to zero.
-     * A value of zero drops all packets for the socket.
-     *
-     * @throws IllegalArgumentException if bandwidth is less than zero.
-     */
-    public SocketFlow bandwidth(long bandwidth) {
-        if (bandwidth < 0) {
-            throw new IllegalArgumentException("invalid bandwidth");
-        } else {
-            this.bandwidth = bandwidth;
-        }
-        return this;
-    }
-
-    /**
-     * Returns this SocketFlow's priority.
-     */
-    public int priority() {
-        return priority;
-    }
-
-    /**
-     * Returns this SocketFlow's bandwidth.
-     *
-     * @return this SocketFlow's bandwidth, or {@code -1} if status is not OK.
-     */
-    public long bandwidth() {
-        return bandwidth;
-    }
-
-    /**
-     * Returns the Status value of this SocketFlow. NO_STATUS is returned
-     * if the object was not used in a call to set or get the option.
-     */
-    public Status status() {
-        return status;
-    }
-}
--- a/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*
- * Copyright (c) 2016, 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 jdk.net;
-
-import java.net.*;
-import java.io.IOException;
-import java.io.FileDescriptor;
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-import java.lang.reflect.Field;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Collections;
-import sun.net.ExtendedOptionsImpl;
-
-/**
- * Defines static methods to set and get socket options defined by the
- * {@link java.net.SocketOption} interface. All of the standard options defined
- * by {@link java.net.Socket}, {@link java.net.ServerSocket}, and
- * {@link java.net.DatagramSocket} can be set this way, as well as additional
- * or platform specific options supported by each socket type.
- * <p>
- * The {@link #supportedOptions(Class)} method can be called to determine
- * the complete set of options available (per socket type) on the
- * current system.
- * <p>
- * When a security manager is installed, some non-standard socket options
- * may require a security permission before being set or get.
- * The details are specified in {@link ExtendedSocketOptions}. No permission
- * is required for {@link java.net.StandardSocketOptions}.
- *
- * @see java.nio.channels.NetworkChannel
- */
-public class Sockets {
-
-    private static final HashMap<Class<?>,Set<SocketOption<?>>>
-        options = new HashMap<>();
-
-    static {
-        initOptionSets();
-    }
-
-    private Sockets() {}
-
-    /**
-     * Sets the value of a socket option on a {@link java.net.Socket}
-     *
-     * @param s the socket
-     * @param name The socket option
-     * @param value The value of the socket option. May be null for some
-     *              options.
-     *
-     * @throws UnsupportedOperationException if the socket does not support
-     *         the option.
-     *
-     * @throws IllegalArgumentException if the value is not valid for
-     *         the option.
-     *
-     * @throws IOException if an I/O error occurs, or socket is closed.
-     *
-     * @throws SecurityException if a security manager is set and the
-     *         caller does not have any required permission.
-     *
-     * @throws NullPointerException if name is null
-     *
-     * @see java.net.StandardSocketOptions
-     */
-    public static <T> void setOption(Socket s, SocketOption<T> name, T value) throws IOException
-    {
-        s.setOption(name, value);
-    }
-
-    /**
-     * Returns the value of a socket option from a {@link java.net.Socket}
-     *
-     * @param s the socket
-     * @param name The socket option
-     *
-     * @return The value of the socket option.
-     *
-     * @throws UnsupportedOperationException if the socket does not support
-     *         the option.
-     *
-     * @throws IOException if an I/O error occurs
-     *
-     * @throws SecurityException if a security manager is set and the
-     *         caller does not have any required permission.
-     *
-     * @throws NullPointerException if name is null
-     *
-     * @see java.net.StandardSocketOptions
-     */
-    public static <T> T getOption(Socket s, SocketOption<T> name) throws IOException
-    {
-        return s.getOption(name);
-    }
-
-    /**
-     * Sets the value of a socket option on a {@link java.net.ServerSocket}
-     *
-     * @param s the socket
-     * @param name The socket option
-     * @param value The value of the socket option.
-     *
-     * @throws UnsupportedOperationException if the socket does not support
-     *         the option.
-     *
-     * @throws IllegalArgumentException if the value is not valid for
-     *         the option.
-     *
-     * @throws IOException if an I/O error occurs
-     *
-     * @throws NullPointerException if name is null
-     *
-     * @throws SecurityException if a security manager is set and the
-     *         caller does not have any required permission.
-     *
-     * @see java.net.StandardSocketOptions
-     */
-    public static <T> void setOption(ServerSocket s, SocketOption<T> name, T value) throws IOException
-    {
-        s.setOption(name, value);
-    }
-
-    /**
-     * Returns the value of a socket option from a {@link java.net.ServerSocket}
-     *
-     * @param s the socket
-     * @param name The socket option
-     *
-     * @return The value of the socket option.
-     *
-     * @throws UnsupportedOperationException if the socket does not support
-     *         the option.
-     *
-     * @throws IOException if an I/O error occurs
-     *
-     * @throws NullPointerException if name is null
-     *
-     * @throws SecurityException if a security manager is set and the
-     *         caller does not have any required permission.
-     *
-     * @see java.net.StandardSocketOptions
-     */
-    public static <T> T getOption(ServerSocket s, SocketOption<T> name) throws IOException
-    {
-        return s.getOption(name);
-    }
-
-    /**
-     * Sets the value of a socket option on a {@link java.net.DatagramSocket}
-     * or {@link java.net.MulticastSocket}
-     *
-     * @param s the socket
-     * @param name The socket option
-     * @param value The value of the socket option.
-     *
-     * @throws UnsupportedOperationException if the socket does not support
-     *         the option.
-     *
-     * @throws IllegalArgumentException if the value is not valid for
-     *         the option.
-     *
-     * @throws IOException if an I/O error occurs
-     *
-     * @throws NullPointerException if name is null
-     *
-     * @throws SecurityException if a security manager is set and the
-     *         caller does not have any required permission.
-     *
-     * @see java.net.StandardSocketOptions
-     */
-    public static <T> void setOption(DatagramSocket s, SocketOption<T> name, T value) throws IOException
-    {
-        s.setOption(name, value);
-    }
-
-    /**
-     * Returns the value of a socket option from a
-     * {@link java.net.DatagramSocket} or {@link java.net.MulticastSocket}
-     *
-     * @param s the socket
-     * @param name The socket option
-     *
-     * @return The value of the socket option.
-     *
-     * @throws UnsupportedOperationException if the socket does not support
-     *         the option.
-     *
-     * @throws IOException if an I/O error occurs
-     *
-     * @throws NullPointerException if name is null
-     *
-     * @throws SecurityException if a security manager is set and the
-     *         caller does not have any required permission.
-     *
-     * @see java.net.StandardSocketOptions
-     */
-    public static <T> T getOption(DatagramSocket s, SocketOption<T> name) throws IOException
-    {
-        return s.getOption(name);
-    }
-
-    /**
-     * Returns a set of {@link java.net.SocketOption}s supported by the
-     * given socket type. This set may include standard options and also
-     * non standard extended options.
-     *
-     * @param socketType the type of java.net socket
-     *
-     * @throws IllegalArgumentException if socketType is not a valid
-     *         socket type from the java.net package.
-     */
-    public static Set<SocketOption<?>> supportedOptions(Class<?> socketType) {
-        Set<SocketOption<?>> set = options.get(socketType);
-        if (set == null) {
-            throw new IllegalArgumentException("unknown socket type");
-        }
-        return set;
-    }
-
-    private static void checkValueType(Object value, Class<?> type) {
-        if (!type.isAssignableFrom(value.getClass())) {
-            String s = "Found: " + value.getClass().toString() + " Expected: "
-                        + type.toString();
-            throw new IllegalArgumentException(s);
-        }
-    }
-
-    private static volatile boolean checkedReusePort;
-    private static volatile boolean isReusePortAvailable;
-
-    /**
-     * Tells whether SO_REUSEPORT is supported.
-     */
-    static boolean isReusePortAvailable() {
-        if (!checkedReusePort) {
-            isReusePortAvailable = isReusePortAvailable0();
-            checkedReusePort = true;
-        }
-        return isReusePortAvailable;
-    }
-
-    private static void initOptionSets() {
-        boolean flowsupported = ExtendedOptionsImpl.flowSupported();
-        boolean reuseportsupported = isReusePortAvailable();
-        // Socket
-
-        Set<SocketOption<?>> set = new HashSet<>();
-        set.add(StandardSocketOptions.SO_KEEPALIVE);
-        set.add(StandardSocketOptions.SO_SNDBUF);
-        set.add(StandardSocketOptions.SO_RCVBUF);
-        set.add(StandardSocketOptions.SO_REUSEADDR);
-        if (reuseportsupported) {
-            set.add(StandardSocketOptions.SO_REUSEPORT);
-        }
-        set.add(StandardSocketOptions.SO_LINGER);
-        set.add(StandardSocketOptions.IP_TOS);
-        set.add(StandardSocketOptions.TCP_NODELAY);
-        if (flowsupported) {
-            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
-        }
-        set = Collections.unmodifiableSet(set);
-        options.put(Socket.class, set);
-
-        // ServerSocket
-
-        set = new HashSet<>();
-        set.add(StandardSocketOptions.SO_RCVBUF);
-        set.add(StandardSocketOptions.SO_REUSEADDR);
-        if (reuseportsupported) {
-            set.add(StandardSocketOptions.SO_REUSEPORT);
-        }
-        set.add(StandardSocketOptions.IP_TOS);
-        set = Collections.unmodifiableSet(set);
-        options.put(ServerSocket.class, set);
-
-        // DatagramSocket
-
-        set = new HashSet<>();
-        set.add(StandardSocketOptions.SO_SNDBUF);
-        set.add(StandardSocketOptions.SO_RCVBUF);
-        set.add(StandardSocketOptions.SO_REUSEADDR);
-        if (reuseportsupported) {
-            set.add(StandardSocketOptions.SO_REUSEPORT);
-        }
-        set.add(StandardSocketOptions.IP_TOS);
-        if (flowsupported) {
-            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
-        }
-        set = Collections.unmodifiableSet(set);
-        options.put(DatagramSocket.class, set);
-
-        // MulticastSocket
-
-        set = new HashSet<>();
-        set.add(StandardSocketOptions.SO_SNDBUF);
-        set.add(StandardSocketOptions.SO_RCVBUF);
-        set.add(StandardSocketOptions.SO_REUSEADDR);
-        if (reuseportsupported) {
-            set.add(StandardSocketOptions.SO_REUSEPORT);
-        }
-        set.add(StandardSocketOptions.IP_TOS);
-        set.add(StandardSocketOptions.IP_MULTICAST_IF);
-        set.add(StandardSocketOptions.IP_MULTICAST_TTL);
-        set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
-        if (flowsupported) {
-            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
-        }
-        set = Collections.unmodifiableSet(set);
-        options.put(MulticastSocket.class, set);
-    }
-
-    private static native boolean isReusePortAvailable0();
-}
--- a/jdk/src/java.base/share/classes/jdk/net/package-info.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Platform specific socket options for the {@code java.net} and {@code java.nio.channels}
- * socket classes.
- *
- * @since 1.8
- */
-
-package jdk.net;
--- a/jdk/src/java.base/share/classes/module-info.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/module-info.java	Fri Apr 29 11:54:18 2016 -0700
@@ -83,8 +83,6 @@
 
     // see JDK-8144062
     exports jdk;
-    // see JDK-8044773
-    exports jdk.net;
 
 
     // the service types defined by the APIs in this module
@@ -168,6 +166,7 @@
         java.sql,
         java.xml,
         jdk.charsets,
+        jdk.net,
         jdk.scripting.nashorn,
         jdk.unsupported,
         jdk.vm.ci;
@@ -194,6 +193,8 @@
         jdk.jvmstat;
     exports sun.net to
         java.httpclient;
+    exports sun.net.ext to
+        jdk.net;
     exports sun.net.dns to
         java.security.jgss,
         jdk.naming.dns;
--- a/jdk/src/java.base/share/classes/sun/net/ExtendedOptionsImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net;
-
-import java.net.*;
-import jdk.net.*;
-import java.io.IOException;
-import java.io.FileDescriptor;
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-import java.lang.reflect.Field;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * Contains the native implementation for extended socket options
- * together with some other static utilities
- */
-public class ExtendedOptionsImpl {
-
-    static {
-        AccessController.doPrivileged((PrivilegedAction<Void>)() -> {
-            System.loadLibrary("net");
-            return null;
-        });
-        init();
-    }
-
-    private ExtendedOptionsImpl() {}
-
-    public static void checkSetOptionPermission(SocketOption<?> option) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm == null) {
-            return;
-        }
-        String check = "setOption." + option.name();
-        sm.checkPermission(new NetworkPermission(check));
-    }
-
-    public static void checkGetOptionPermission(SocketOption<?> option) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm == null) {
-            return;
-        }
-        String check = "getOption." + option.name();
-        sm.checkPermission(new NetworkPermission(check));
-    }
-
-    public static void checkValueType(Object value, Class<?> type) {
-        if (!type.isAssignableFrom(value.getClass())) {
-            String s = "Found: " + value.getClass().toString() + " Expected: "
-                        + type.toString();
-            throw new IllegalArgumentException(s);
-        }
-    }
-
-    private static native void init();
-
-    /*
-     * Extension native implementations
-     *
-     * SO_FLOW_SLA
-     */
-    public static native void setFlowOption(FileDescriptor fd, SocketFlow f);
-    public static native void getFlowOption(FileDescriptor fd, SocketFlow f);
-    public static native boolean flowSupported();
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/net/ext/ExtendedSocketOptions.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016, 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.net.ext;
+
+import java.io.FileDescriptor;
+import java.net.SocketException;
+import java.net.SocketOption;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Defines the infrastructure to support extended socket options, beyond those
+ * defined in {@link java.net.StandardSocketOptions}.
+ *
+ * Extended socket options are accessed through the jdk.net API, which is in
+ * the jdk.net module.
+ */
+public abstract class ExtendedSocketOptions {
+
+    private final Set<SocketOption<?>> options;
+
+    /** Tells whether or not the option is supported. */
+    public final boolean isOptionSupported(SocketOption<?> option) {
+        return options().contains(option);
+    }
+
+    /** Return the, possibly empty, set of extended socket options available. */
+    public final Set<SocketOption<?>> options() { return options; }
+
+    /** Sets the value of a socket option, for the given socket. */
+    public abstract void setOption(FileDescriptor fd, SocketOption<?> option, Object value)
+            throws SocketException;
+
+    /** Returns the value of a socket option, for the given socket. */
+    public abstract Object getOption(FileDescriptor fd, SocketOption<?> option)
+            throws SocketException;
+
+    protected ExtendedSocketOptions(Set<SocketOption<?>> options) {
+        this.options = options;
+    }
+
+    private static volatile ExtendedSocketOptions instance;
+
+    public static final ExtendedSocketOptions getInstance() { return instance; }
+
+    /** Registers support for extended socket options. Invoked by the jdk.net module. */
+    public static final void register(ExtendedSocketOptions extOptions) {
+        if (instance != null)
+            throw new InternalError("Attempting to reregister extended options");
+
+        instance = extOptions;
+    }
+
+    static {
+        try {
+            // If the class is present, it will be initialized which
+            // triggers registration of the extended socket options.
+            Class<?> c = Class.forName("jdk.net.ExtendedSocketOptions");
+        } catch (ClassNotFoundException e) {
+            // the jdk.net module is not present => no extended socket options
+            instance = new NoExtendedSocketOptions();
+        }
+    }
+
+    static final class NoExtendedSocketOptions extends ExtendedSocketOptions {
+
+        NoExtendedSocketOptions() {
+            super(Collections.<SocketOption<?>>emptySet());
+        }
+
+        @Override
+        public void setOption(FileDescriptor fd, SocketOption<?> option, Object value)
+            throws SocketException
+        {
+            throw new UnsupportedOperationException(
+                    "no extended options: " + option.name());
+        }
+
+        @Override
+        public Object getOption(FileDescriptor fd, SocketOption<?> option)
+            throws SocketException
+        {
+            throw new UnsupportedOperationException(
+                    "no extended options: " + option.name());
+        }
+    }
+}
--- a/jdk/src/java.base/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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,7 +29,6 @@
 import java.nio.channels.*;
 import java.nio.channels.spi.*;
 import java.util.*;
-import sun.misc.*;
 
 
 /**
--- a/jdk/src/java.base/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -39,7 +39,7 @@
 import java.util.concurrent.*;
 import java.util.concurrent.locks.*;
 import sun.net.NetHooks;
-import sun.net.ExtendedOptionsImpl;
+import sun.net.ext.ExtendedSocketOptions;
 
 /**
  * Base implementation of AsynchronousSocketChannel
@@ -512,9 +512,9 @@
                 set.add(StandardSocketOptions.SO_REUSEPORT);
             }
             set.add(StandardSocketOptions.TCP_NODELAY);
-            if (ExtendedOptionsImpl.flowSupported()) {
-                set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
-            }
+            ExtendedSocketOptions extendedOptions =
+                    ExtendedSocketOptions.getInstance();
+            set.addAll(extendedOptions.options());
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -33,7 +33,7 @@
 import java.nio.channels.spi.*;
 import java.util.*;
 import sun.net.ResourceManager;
-import sun.net.ExtendedOptionsImpl;
+import sun.net.ext.ExtendedSocketOptions;
 
 /**
  * An implementation of DatagramChannels.
@@ -306,9 +306,9 @@
             set.add(StandardSocketOptions.IP_MULTICAST_IF);
             set.add(StandardSocketOptions.IP_MULTICAST_TTL);
             set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
-            if (ExtendedOptionsImpl.flowSupported()) {
-                set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
-            }
+            ExtendedSocketOptions extendedOptions =
+                    ExtendedSocketOptions.getInstance();
+            set.addAll(extendedOptions.options());
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/java.base/share/classes/sun/nio/ch/Net.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/Net.java	Fri Apr 29 11:54:18 2016 -0700
@@ -27,15 +27,13 @@
 
 import java.io.*;
 import java.net.*;
-import jdk.net.*;
 import java.nio.channels.*;
 import java.util.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.net.ExtendedOptionsImpl;
+import sun.net.ext.ExtendedSocketOptions;
 import sun.security.action.GetPropertyAction;
 
-
 public class Net {
 
     private Net() { }
@@ -281,6 +279,9 @@
 
     // -- Socket options
 
+    static final ExtendedSocketOptions extendedOptions =
+            ExtendedSocketOptions.getInstance();
+
     static void setSocketOption(FileDescriptor fd, ProtocolFamily family,
                                 SocketOption<?> name, Object value)
         throws IOException
@@ -291,12 +292,8 @@
         // only simple values supported by this method
         Class<?> type = name.type();
 
-        if (type == SocketFlow.class) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(new NetworkPermission("setOption.SO_FLOW_SLA"));
-            }
-            ExtendedOptionsImpl.setFlowOption(fd, (SocketFlow)value);
+        if (extendedOptions.isOptionSupported(name)) {
+            extendedOptions.setOption(fd, name, value);
             return;
         }
 
@@ -353,14 +350,8 @@
     {
         Class<?> type = name.type();
 
-        if (type == SocketFlow.class) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(new NetworkPermission("getOption.SO_FLOW_SLA"));
-            }
-            SocketFlow flow = SocketFlow.create();
-            ExtendedOptionsImpl.getFlowOption(fd, flow);
-            return flow;
+        if (extendedOptions.isOptionSupported(name)) {
+            return extendedOptions.getOption(fd, name);
         }
 
         // only simple values supported by this method
--- a/jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -33,8 +33,7 @@
 import java.nio.channels.spi.*;
 import java.util.*;
 import sun.net.NetHooks;
-import sun.net.ExtendedOptionsImpl;
-
+import sun.net.ext.ExtendedSocketOptions;
 
 /**
  * An implementation of SocketChannels
@@ -242,9 +241,9 @@
             // additional options required by socket adaptor
             set.add(StandardSocketOptions.IP_TOS);
             set.add(ExtendedSocketOption.SO_OOBINLINE);
-            if (ExtendedOptionsImpl.flowSupported()) {
-                set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
-            }
+            ExtendedSocketOptions extendedOptions =
+                    ExtendedSocketOptions.getInstance();
+            set.addAll(extendedOptions.options());
             return Collections.unmodifiableSet(set);
         }
     }
--- a/jdk/src/java.base/share/classes/sun/security/action/GetBooleanSecurityPropertyAction.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +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 sun.security.action;
-
-import java.security.Security;
-
-/**
- * A convenience class for retrieving the boolean value of a security property
- * as a privileged action.
- *
- * <p>An instance of this class can be used as the argument of
- * <code>AccessController.doPrivileged</code>.
- *
- * <p>The following code retrieves the boolean value of the security
- * property named <code>"prop"</code> as a privileged action:
- *
- * <pre>
- * boolean b = java.security.AccessController.doPrivileged
- *              (new GetBooleanSecurityPropertyAction("prop")).booleanValue();
- * </pre>
- *
- */
-public class GetBooleanSecurityPropertyAction
-        implements java.security.PrivilegedAction<Boolean> {
-    private String theProp;
-
-    /**
-     * Constructor that takes the name of the security property whose boolean
-     * value needs to be determined.
-     *
-     * @param theProp the name of the security property
-     */
-    public GetBooleanSecurityPropertyAction(String theProp) {
-        this.theProp = theProp;
-    }
-
-    /**
-     * Determines the boolean value of the security property whose name was
-     * specified in the constructor.
-     *
-     * @return the <code>Boolean</code> value of the security property.
-     */
-    public Boolean run() {
-        boolean b = false;
-        try {
-            String value = Security.getProperty(theProp);
-            b = (value != null) && value.equalsIgnoreCase("true");
-        } catch (NullPointerException e) {}
-        return b;
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java	Fri Apr 29 11:54:18 2016 -0700
@@ -286,12 +286,15 @@
         }
         if (log == null) {
             log = new PlatformLogger(PlatformLogger.Bridge.convert(
-                    // We pass PlatformLogger.class rather than the actual caller
+                    // We pass PlatformLogger.class.getModule() (java.base)
+                    // rather than the actual module of the caller
                     // because we want PlatformLoggers to be system loggers: we
                     // won't need to resolve any resource bundles anyway.
                     // Note: Many unit tests depend on the fact that
-                    //       PlatformLogger.getLoggerFromFinder is not caller sensitive.
-                    LazyLoggers.getLazyLogger(name, PlatformLogger.class)));
+                    //       PlatformLogger.getLoggerFromFinder is not caller
+                    //       sensitive, and this strategy ensure that the tests
+                    //       still pass.
+                    LazyLoggers.getLazyLogger(name, PlatformLogger.class.getModule())));
             loggers.put(name, new WeakReference<>(log));
         }
         return log;
--- a/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -27,9 +27,7 @@
 import java.io.IOException;
 import java.util.Set;
 import java.util.HashSet;
-import java.util.Collections;
-import jdk.net.*;
-import static sun.net.ExtendedOptionsImpl.*;
+import sun.net.ext.ExtendedSocketOptions;
 
 /*
  * On Unix systems we simply delegate to native methods.
@@ -43,8 +41,11 @@
         init();
     }
 
+    static final ExtendedSocketOptions extendedOptions =
+            ExtendedSocketOptions.getInstance();
+
     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
-        if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
+        if (!extendedOptions.isOptionSupported(name)) {
             if (!name.equals(StandardSocketOptions.SO_REUSEPORT)) {
                 super.setOption(name, value);
             } else {
@@ -55,21 +56,16 @@
                }
             }
         } else {
-            if (!flowSupported()) {
-                throw new UnsupportedOperationException("unsupported option");
-            }
             if (isClosed()) {
                 throw new SocketException("Socket closed");
             }
-            checkSetOptionPermission(name);
-            checkValueType(value, SocketFlow.class);
-            setFlowOption(getFileDescriptor(), (SocketFlow)value);
+            extendedOptions.setOption(fd, name, value);
         }
     }
 
     @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
-        if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
+        if (!extendedOptions.isOptionSupported(name)) {
             if (!name.equals(StandardSocketOptions.SO_REUSEPORT)) {
                 return super.getOption(name);
             } else {
@@ -79,31 +75,23 @@
                     throw new UnsupportedOperationException("unsupported option");
                 }
             }
-        }
-        if (!flowSupported()) {
-            throw new UnsupportedOperationException("unsupported option");
+        } else {
+            if (isClosed()) {
+                throw new SocketException("Socket closed");
+            }
+            return (T) extendedOptions.getOption(fd, name);
         }
-        if (isClosed()) {
-            throw new SocketException("Socket closed");
-        }
-        checkGetOptionPermission(name);
-        SocketFlow flow = SocketFlow.create();
-        getFlowOption(getFileDescriptor(), flow);
-        return (T)flow;
     }
 
     protected Set<SocketOption<?>> supportedOptions() {
-        HashSet<SocketOption<?>> options = new HashSet<>(
-            super.supportedOptions());
-
-        if (flowSupported()) {
-            options.add(ExtendedSocketOptions.SO_FLOW_SLA);
-        }
+        HashSet<SocketOption<?>> options = new HashSet<>(super.supportedOptions());
+        options.addAll(extendedOptions.options());
         return options;
     }
 
     protected void socketSetOption(int opt, Object val) throws SocketException {
-        if (opt == SocketOptions.SO_REUSEPORT && !supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
+        if (opt == SocketOptions.SO_REUSEPORT &&
+            !supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
             throw new UnsupportedOperationException("unsupported option");
         }
         try {
--- a/jdk/src/java.base/unix/classes/java/net/PlainSocketImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/unix/classes/java/net/PlainSocketImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -28,10 +28,7 @@
 import java.io.FileDescriptor;
 import java.util.Set;
 import java.util.HashSet;
-import java.util.Collections;
-import jdk.net.*;
-
-import static sun.net.ExtendedOptionsImpl.*;
+import sun.net.ext.ExtendedSocketOptions;
 
 /*
  * On Unix systems we simply delegate to native methods.
@@ -57,8 +54,11 @@
         this.fd = fd;
     }
 
+    static final ExtendedSocketOptions extendedOptions =
+            ExtendedSocketOptions.getInstance();
+
     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
-        if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
+        if (!extendedOptions.isOptionSupported(name)) {
             if (!name.equals(StandardSocketOptions.SO_REUSEPORT)) {
                 super.setOption(name, value);
             } else {
@@ -69,21 +69,19 @@
                 }
             }
         } else {
-            if (getSocket() == null || !flowSupported()) {
+            if (getSocket() == null) {
                 throw new UnsupportedOperationException("unsupported option");
             }
             if (isClosedOrPending()) {
                 throw new SocketException("Socket closed");
             }
-            checkSetOptionPermission(name);
-            checkValueType(value, SocketFlow.class);
-            setFlowOption(getFileDescriptor(), (SocketFlow)value);
+            extendedOptions.setOption(fd, name, value);
         }
     }
 
     @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
-        if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
+        if (!extendedOptions.isOptionSupported(name)) {
             if (!name.equals(StandardSocketOptions.SO_REUSEPORT)) {
                 return super.getOption(name);
             } else {
@@ -93,31 +91,28 @@
                     throw new UnsupportedOperationException("unsupported option");
                 }
             }
-        }
-        if (getSocket() == null || !flowSupported()) {
-            throw new UnsupportedOperationException("unsupported option");
+        } else {
+            if (getSocket() == null) {
+                throw new UnsupportedOperationException("unsupported option");
+            }
+            if (isClosedOrPending()) {
+                throw new SocketException("Socket closed");
+            }
+            return (T) extendedOptions.getOption(fd, name);
         }
-        if (isClosedOrPending()) {
-            throw new SocketException("Socket closed");
-        }
-        checkGetOptionPermission(name);
-        SocketFlow flow = SocketFlow.create();
-        getFlowOption(getFileDescriptor(), flow);
-        return (T)flow;
     }
 
     protected Set<SocketOption<?>> supportedOptions() {
-        HashSet<SocketOption<?>> options = new HashSet<>(
-            super.supportedOptions());
-
-        if (getSocket() != null && flowSupported()) {
-            options.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        HashSet<SocketOption<?>> options = new HashSet<>(super.supportedOptions());
+        if (getSocket() != null) {
+            options.addAll(extendedOptions.options());
         }
         return options;
     }
 
     protected void socketSetOption(int opt, boolean b, Object val) throws SocketException {
-        if (opt == SocketOptions.SO_REUSEPORT && !supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
+        if (opt == SocketOptions.SO_REUSEPORT &&
+            !supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
             throw new UnsupportedOperationException("unsupported option");
         }
         try {
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/PollSelectorImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/PollSelectorImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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,7 +29,6 @@
 import java.nio.channels.*;
 import java.nio.channels.spi.*;
 import java.util.*;
-import sun.misc.*;
 
 
 /**
--- a/jdk/src/java.base/unix/native/libnet/ExtendedOptionsImpl.c	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,344 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <jni.h>
-#include <string.h>
-
-#include "net_util.h"
-#include "jdk_net_SocketFlow.h"
-
-static jclass sf_status_class;          /* Status enum type */
-
-static jfieldID sf_status;
-static jfieldID sf_priority;
-static jfieldID sf_bandwidth;
-
-static jfieldID sf_fd_fdID;             /* FileDescriptor.fd */
-
-/* References to the literal enum values */
-
-static jobject sfs_NOSTATUS;
-static jobject sfs_OK;
-static jobject sfs_NOPERMISSION;
-static jobject sfs_NOTCONNECTED;
-static jobject sfs_NOTSUPPORTED;
-static jobject sfs_ALREADYCREATED;
-static jobject sfs_INPROGRESS;
-static jobject sfs_OTHER;
-
-static jobject getEnumField(JNIEnv *env, char *name);
-static void setStatus(JNIEnv *env, jobject obj, int errval);
-
-/* OS specific code is implemented in these three functions */
-
-static jboolean flowSupported0() ;
-
-/*
- * Class:     sun_net_ExtendedOptionsImpl
- * Method:    init
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_init
-  (JNIEnv *env, jclass UNUSED)
-{
-    static int initialized = 0;
-    jclass c;
-
-    /* Global class references */
-
-    if (initialized) {
-        return;
-    }
-
-    c = (*env)->FindClass(env, "jdk/net/SocketFlow$Status");
-    CHECK_NULL(c);
-    sf_status_class = (*env)->NewGlobalRef(env, c);
-    CHECK_NULL(sf_status_class);
-
-    /* int "fd" field of java.io.FileDescriptor  */
-
-    c = (*env)->FindClass(env, "java/io/FileDescriptor");
-    CHECK_NULL(c);
-    sf_fd_fdID = (*env)->GetFieldID(env, c, "fd", "I");
-    CHECK_NULL(sf_fd_fdID);
-
-
-    /* SocketFlow fields */
-
-    c = (*env)->FindClass(env, "jdk/net/SocketFlow");
-    CHECK_NULL(c);
-
-    /* status */
-
-    sf_status = (*env)->GetFieldID(env, c, "status",
-                                        "Ljdk/net/SocketFlow$Status;");
-    CHECK_NULL(sf_status);
-
-    /* priority */
-
-    sf_priority = (*env)->GetFieldID(env, c, "priority", "I");
-    CHECK_NULL(sf_priority);
-
-    /* bandwidth */
-
-    sf_bandwidth = (*env)->GetFieldID(env, c, "bandwidth", "J");
-    CHECK_NULL(sf_bandwidth);
-
-    /* Initialize the static enum values */
-
-    sfs_NOSTATUS = getEnumField(env, "NO_STATUS");
-    CHECK_NULL(sfs_NOSTATUS);
-    sfs_OK = getEnumField(env, "OK");
-    CHECK_NULL(sfs_OK);
-    sfs_NOPERMISSION = getEnumField(env, "NO_PERMISSION");
-    CHECK_NULL(sfs_NOPERMISSION);
-    sfs_NOTCONNECTED = getEnumField(env, "NOT_CONNECTED");
-    CHECK_NULL(sfs_NOTCONNECTED);
-    sfs_NOTSUPPORTED = getEnumField(env, "NOT_SUPPORTED");
-    CHECK_NULL(sfs_NOTSUPPORTED);
-    sfs_ALREADYCREATED = getEnumField(env, "ALREADY_CREATED");
-    CHECK_NULL(sfs_ALREADYCREATED);
-    sfs_INPROGRESS = getEnumField(env, "IN_PROGRESS");
-    CHECK_NULL(sfs_INPROGRESS);
-    sfs_OTHER = getEnumField(env, "OTHER");
-    CHECK_NULL(sfs_OTHER);
-    initialized = JNI_TRUE;
-}
-
-static jobject getEnumField(JNIEnv *env, char *name)
-{
-    jobject f;
-    jfieldID fID = (*env)->GetStaticFieldID(env, sf_status_class, name,
-        "Ljdk/net/SocketFlow$Status;");
-    CHECK_NULL_RETURN(fID, NULL);
-
-    f = (*env)->GetStaticObjectField(env, sf_status_class, fID);
-    CHECK_NULL_RETURN(f, NULL);
-    f  = (*env)->NewGlobalRef(env, f);
-    CHECK_NULL_RETURN(f, NULL);
-    return f;
-}
-
-/*
- * Retrieve the int file-descriptor from a public socket type object.
- * Gets impl, then the FileDescriptor from the impl, and then the fd
- * from that.
- */
-static int getFD(JNIEnv *env, jobject fileDesc) {
-    return (*env)->GetIntField(env, fileDesc, sf_fd_fdID);
-}
-
-/**
- * Sets the status field of a SocketFlow to one of the
- * canned enum values
- */
-static void setStatus (JNIEnv *env, jobject obj, int errval)
-{
-    switch (errval) {
-      case 0: /* OK */
-        (*env)->SetObjectField(env, obj, sf_status, sfs_OK);
-        break;
-      case EPERM:
-        (*env)->SetObjectField(env, obj, sf_status, sfs_NOPERMISSION);
-        break;
-      case ENOTCONN:
-        (*env)->SetObjectField(env, obj, sf_status, sfs_NOTCONNECTED);
-        break;
-      case EOPNOTSUPP:
-        (*env)->SetObjectField(env, obj, sf_status, sfs_NOTSUPPORTED);
-        break;
-      case EALREADY:
-        (*env)->SetObjectField(env, obj, sf_status, sfs_ALREADYCREATED);
-        break;
-      case EINPROGRESS:
-        (*env)->SetObjectField(env, obj, sf_status, sfs_INPROGRESS);
-        break;
-      default:
-        (*env)->SetObjectField(env, obj, sf_status, sfs_OTHER);
-        break;
-    }
-}
-
-#ifdef __solaris__
-
-/*
- * Class:     sun_net_ExtendedOptionsImpl
- * Method:    setFlowOption
- * Signature: (Ljava/io/FileDescriptor;Ljdk/net/SocketFlow;)V
- */
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption
-  (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow)
-{
-    int fd = getFD(env, fileDesc);
-
-    if (fd < 0) {
-        NET_ERROR(env, JNU_JAVANETPKG "SocketException", "socket closed");
-        return;
-    } else {
-        sock_flow_props_t props;
-        jlong bandwidth;
-        int rv;
-
-        jint priority = (*env)->GetIntField(env, flow, sf_priority);
-        memset(&props, 0, sizeof(props));
-        props.sfp_version = SOCK_FLOW_PROP_VERSION1;
-
-        if (priority != jdk_net_SocketFlow_UNSET) {
-            props.sfp_mask |= SFP_PRIORITY;
-            props.sfp_priority = priority;
-        }
-        bandwidth = (*env)->GetLongField(env, flow, sf_bandwidth);
-        if (bandwidth > -1)  {
-            props.sfp_mask |= SFP_MAXBW;
-            props.sfp_maxbw = (uint64_t) bandwidth;
-        }
-        rv = setsockopt(fd, SOL_SOCKET, SO_FLOW_SLA, &props, sizeof(props));
-        if (rv < 0) {
-            if (errno == ENOPROTOOPT) {
-                JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-                        "unsupported socket option");
-            } else if (errno == EACCES || errno == EPERM) {
-                NET_ERROR(env, JNU_JAVANETPKG "SocketException",
-                                "Permission denied");
-            } else {
-                NET_ERROR(env, JNU_JAVANETPKG "SocketException",
-                                "set option SO_FLOW_SLA failed");
-            }
-            return;
-        }
-        setStatus(env, flow, props.sfp_status);
-    }
-}
-
-/*
- * Class:     sun_net_ExtendedOptionsImpl
- * Method:    getFlowOption
- * Signature: (Ljava/io/FileDescriptor;Ljdk/net/SocketFlow;)V
- */
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption
-  (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow)
-{
-    int fd = getFD(env, fileDesc);
-
-    if (fd < 0) {
-        NET_ERROR(env, JNU_JAVANETPKG "SocketException", "socket closed");
-        return;
-    } else {
-        sock_flow_props_t props;
-        int status;
-        socklen_t sz = sizeof(props);
-
-        int rv = getsockopt(fd, SOL_SOCKET, SO_FLOW_SLA, &props, &sz);
-        if (rv < 0) {
-            if (errno == ENOPROTOOPT) {
-                JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-                        "unsupported socket option");
-            } else if (errno == EACCES || errno == EPERM) {
-                NET_ERROR(env, JNU_JAVANETPKG "SocketException",
-                                "Permission denied");
-            } else {
-                NET_ERROR(env, JNU_JAVANETPKG "SocketException",
-                                "set option SO_FLOW_SLA failed");
-            }
-            return;
-        }
-        /* first check status to see if flow exists */
-        status = props.sfp_status;
-        setStatus(env, flow, status);
-        if (status == 0) { /* OK */
-            /* can set the other fields now */
-            if (props.sfp_mask & SFP_PRIORITY) {
-                (*env)->SetIntField(env, flow, sf_priority, props.sfp_priority);
-            }
-            if (props.sfp_mask & SFP_MAXBW) {
-                (*env)->SetLongField(env, flow, sf_bandwidth,
-                                        (jlong)props.sfp_maxbw);
-            }
-        }
-    }
-}
-
-static jboolean flowsupported;
-static jboolean flowsupported_set = JNI_FALSE;
-
-static jboolean flowSupported0()
-{
-    /* Do a simple dummy call, and try to figure out from that */
-    sock_flow_props_t props;
-    int rv, s;
-    if (flowsupported_set) {
-        return flowsupported;
-    }
-    s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
-    if (s < 0) {
-        flowsupported = JNI_FALSE;
-        flowsupported_set = JNI_TRUE;
-        return JNI_FALSE;
-    }
-    memset(&props, 0, sizeof(props));
-    props.sfp_version = SOCK_FLOW_PROP_VERSION1;
-    props.sfp_mask |= SFP_PRIORITY;
-    props.sfp_priority = SFP_PRIO_NORMAL;
-    rv = setsockopt(s, SOL_SOCKET, SO_FLOW_SLA, &props, sizeof(props));
-    if (rv != 0 && errno == ENOPROTOOPT) {
-        rv = JNI_FALSE;
-    } else {
-        rv = JNI_TRUE;
-    }
-    close(s);
-    flowsupported = rv;
-    flowsupported_set = JNI_TRUE;
-    return flowsupported;
-}
-
-#else /* __solaris__ */
-
-/* Non Solaris. Functionality is not supported. So, throw UnsupportedOpExc */
-
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption
-  (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow)
-{
-    JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-        "unsupported socket option");
-}
-
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption
-  (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow)
-{
-    JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-        "unsupported socket option");
-}
-
-static jboolean flowSupported0()  {
-    return JNI_FALSE;
-}
-
-#endif /* __solaris__ */
-
-JNIEXPORT jboolean JNICALL Java_sun_net_ExtendedOptionsImpl_flowSupported
-  (JNIEnv *env, jclass UNUSED)
-{
-    return flowSupported0();
-}
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.h	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.h	Fri Apr 29 11:54:18 2016 -0700
@@ -120,47 +120,6 @@
 
 #ifdef __solaris__
 int net_getParam(char *driver, char *param);
-
-#ifndef SO_FLOW_SLA
-#define SO_FLOW_SLA 0x1018
-
-#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
-#pragma pack(4)
 #endif
 
-/*
- * Used with the setsockopt(SO_FLOW_SLA, ...) call to set
- * per socket service level properties.
- * When the application uses per-socket API, we will enforce the properties
- * on both outbound and inbound packets.
- *
- * For now, only priority and maxbw are supported in SOCK_FLOW_PROP_VERSION1.
- */
-typedef struct sock_flow_props_s {
-        int             sfp_version;
-        uint32_t        sfp_mask;
-        int             sfp_priority;   /* flow priority */
-        uint64_t        sfp_maxbw;      /* bandwidth limit in bps */
-        int             sfp_status;     /* flow create status for getsockopt */
-} sock_flow_props_t;
-
-#define SOCK_FLOW_PROP_VERSION1 1
-
-/* bit mask values for sfp_mask */
-#define SFP_MAXBW       0x00000001      /* Flow Bandwidth Limit */
-#define SFP_PRIORITY    0x00000008      /* Flow priority */
-
-/* possible values for sfp_priority */
-#define SFP_PRIO_NORMAL 1
-#define SFP_PRIO_HIGH   2
-
-#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
-#pragma pack()
-#endif /* _LONG_LONG_ALIGNMENT */
-
-#endif /* SO_FLOW_SLA */
-#endif /* __solaris__ */
-
-JNIEXPORT jboolean JNICALL NET_IsFlowSupported();
-
 #endif /* NET_UTILS_MD_H */
--- a/jdk/src/java.base/windows/native/libnet/ExtendedOptionsImpl.c	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <jni.h>
-#include <string.h>
-
-#include "net_util.h"
-
-/*
- * Class:     sun_net_ExtendedOptionsImpl
- * Method:    init
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_init
-  (JNIEnv *env, jclass UNUSED)
-{
-}
-
-/* Non Solaris. Functionality is not supported. So, throw UnsupportedOpExc */
-
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption
-  (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow)
-{
-    JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-        "unsupported socket option");
-}
-
-JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption
-  (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow)
-{
-    JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
-        "unsupported socket option");
-}
-
-static jboolean flowSupported0()  {
-    return JNI_FALSE;
-}
-
-JNIEXPORT jboolean JNICALL Java_sun_net_ExtendedOptionsImpl_flowSupported
-  (JNIEnv *env, jclass UNUSED)
-{
-    return JNI_FALSE;
-}
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Fri Apr 29 11:54:18 2016 -0700
@@ -52,7 +52,6 @@
 import sun.awt.datatransfer.DataTransferer;
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
-import sun.misc.*;
 import sun.awt.util.PerformanceLogger;
 import sun.awt.util.ThreadGroupUtils;
 import sun.print.PrintJob2D;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Fri Apr 29 11:54:18 2016 -0700
@@ -265,7 +265,7 @@
     if (isGtkSupported) {
         gtk->gdk_threads_enter();
         gtk_failed = gtk->get_drawable_data(env, pixelArray, x, y, width,
-                                            jwidth, height, dx, dy, scale);
+                                            height, jwidth, dx, dy, scale);
         gtk->gdk_threads_leave();
     }
 
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Fri Apr 29 11:54:18 2016 -0700
@@ -442,6 +442,7 @@
              fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
 #endif /* DEBUG */
         } else {
+            gtk->gtk_show_uri = fp_gtk_show_uri;
             update_supported_actions(env);
             success = TRUE;
         }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Fri Apr 29 11:54:18 2016 -0700
@@ -195,6 +195,7 @@
         fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
 #endif /* DEBUG */
     } else {
+        gtk->gtk_show_uri = fp_gtk_show_uri;
         update_supported_actions(env);
         success = TRUE;
     }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, 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
@@ -72,8 +72,8 @@
 
 #include <dlfcn.h>
 
-#if defined(__solaris__) || defined(_AIX)
-/* Solaris 10 and AIX will not have these symbols at runtime */
+#if defined(__solaris__)
+/* Solaris 10 will not have these symbols at compile time */
 
 typedef Picture (*XRenderCreateLinearGradientFuncType)
                                      (Display *dpy,
@@ -147,7 +147,22 @@
         return JNI_FALSE;
     }
 
-#if defined(__solaris__) || defined(_AIX)
+#if defined(_AIX)
+    // On AIX we have to use a special syntax because the shared libraries are packed in
+    // multi-architecture archives. We first try to load the system default libXrender
+    // which is contained in the 'X11.base.lib' fileset starting with AIX 6.1
+    xrenderlib = dlopen("libXrender.a(shr_64.o)", RTLD_GLOBAL | RTLD_LAZY | RTLD_MEMBER);
+    if (xrenderlib == NULL) {
+      // If the latter wasn't successful, we also try to load the version under /opt/freeware
+      // This may be downloaded from the "AIX Toolbox for Linux Applications" even for AIX 5.3
+      xrenderlib = dlopen("libXrender.a(libXrender.so.0)", RTLD_GLOBAL | RTLD_LAZY | RTLD_MEMBER);
+    }
+    if (xrenderlib != NULL) {
+      dlclose(xrenderlib);
+    } else {
+      available = JNI_FALSE;
+    }
+#elif defined(__solaris__)
     xrenderlib = dlopen("libXrender.so",RTLD_GLOBAL|RTLD_LAZY);
     if (xrenderlib != NULL) {
 
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Fri Apr 29 11:54:18 2016 -0700
@@ -43,6 +43,8 @@
 import jdk.internal.misc.JavaAWTAccess;
 import jdk.internal.misc.SharedSecrets;
 import sun.util.logging.internal.LoggingProviderImpl;
+import java.lang.reflect.Module;
+import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
 
 /**
  * There is a single global LogManager object that is used to
@@ -503,10 +505,16 @@
     // as a LogManager subclass may override the addLogger, getLogger,
     // readConfiguration, and other methods.
     Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
+        final Module module = caller == null ? null : caller.getModule();
+        return demandLogger(name, resourceBundleName, module);
+    }
+
+    Logger demandLogger(String name, String resourceBundleName, Module module) {
         Logger result = getLogger(name);
         if (result == null) {
             // only allocate the new logger once
-            Logger newLogger = new Logger(name, resourceBundleName, caller, this, false);
+            Logger newLogger = new Logger(name, resourceBundleName,
+                    module == null ? null : module, this, false);
             do {
                 if (addLogger(newLogger)) {
                     // We successfully added the new Logger that we
@@ -532,9 +540,14 @@
     }
 
     Logger demandSystemLogger(String name, String resourceBundleName, Class<?> caller) {
+        final Module module = caller == null ? null : caller.getModule();
+        return demandSystemLogger(name, resourceBundleName, module);
+    }
+
+    Logger demandSystemLogger(String name, String resourceBundleName, Module module) {
         // Add a system logger in the system context's namespace
         final Logger sysLogger = getSystemContext()
-                .demandLogger(name, resourceBundleName, caller);
+                .demandLogger(name, resourceBundleName, module);
 
         // Add the system logger to the LogManager's namespace if not exist
         // so that there is only one single logger of the given name.
@@ -619,11 +632,11 @@
             return global;
         }
 
-        Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
+        Logger demandLogger(String name, String resourceBundleName, Module module) {
             // a LogManager subclass may have its own implementation to add and
             // get a Logger.  So delegate to the LogManager to do the work.
             final LogManager owner = getOwner();
-            return owner.demandLogger(name, resourceBundleName, caller);
+            return owner.demandLogger(name, resourceBundleName, module);
         }
 
 
@@ -907,11 +920,13 @@
         // one single logger of the given name.  System loggers are visible
         // to applications unless a logger of the same name has been added.
         @Override
-        Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
+        Logger demandLogger(String name, String resourceBundleName,
+                            Module module) {
             Logger result = findLogger(name);
             if (result == null) {
                 // only allocate the new system logger once
-                Logger newLogger = new Logger(name, resourceBundleName, caller, getOwner(), true);
+                Logger newLogger = new Logger(name, resourceBundleName,
+                                              module, getOwner(), true);
                 do {
                     if (addLocalLogger(newLogger)) {
                         // We successfully added the new Logger that we
@@ -2622,18 +2637,18 @@
         }
 
         /**
-         * Demands a logger on behalf of the given {@code caller}.
+         * Demands a logger on behalf of the given {@code module}.
          * <p>
-         * If a named logger suitable for the given caller is found
+         * If a named logger suitable for the given module is found
          * returns it.
-         * Otherwise, creates a new logger suitable for the given caller.
+         * Otherwise, creates a new logger suitable for the given module.
          *
          * @param name   The logger name.
-         * @param caller The caller on which behalf the logger is created/retrieved.
-         * @return A logger for the given {@code caller}.
+         * @param module The module on which behalf the logger is created/retrieved.
+         * @return A logger for the given {@code module}.
          *
          * @throws NullPointerException if {@code name} is {@code null}
-         *         or {@code caller} is {@code null}.
+         *         or {@code module} is {@code null}.
          * @throws IllegalArgumentException if {@code manager} is not the default
          *         LogManager.
          * @throws SecurityException if a security manager is present and the
@@ -2641,7 +2656,7 @@
          *        {@link LoggingPermission LoggingPermission("demandLogger", null)}.
          */
         @Override
-        public Logger demandLoggerFor(LogManager manager, String name, /* Module */ Class<?> caller) {
+        public Logger demandLoggerFor(LogManager manager, String name, Module module) {
             if (manager != getLogManager()) {
                 // having LogManager as parameter just ensures that the
                 // caller will have initialized the LogManager before reaching
@@ -2649,15 +2664,16 @@
                 throw new IllegalArgumentException("manager");
             }
             Objects.requireNonNull(name);
+            Objects.requireNonNull(module);
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(controlPermission);
             }
-            if (caller.getClassLoader() == null) {
+            if (isSystem(module)) {
                 return manager.demandSystemLogger(name,
-                    Logger.SYSTEM_LOGGER_RB_NAME, caller);
+                    Logger.SYSTEM_LOGGER_RB_NAME, module);
             } else {
-                return manager.demandLogger(name, null, caller);
+                return manager.demandLogger(name, null, module);
             }
         }
 
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Fri Apr 29 11:54:18 2016 -0700
@@ -40,6 +40,7 @@
 import java.util.function.Supplier;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
+import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
 
 /**
  * A Logger object is used to log messages for a specific
@@ -379,7 +380,8 @@
         this(name, resourceBundleName, null, LogManager.getLogManager(), false);
     }
 
-    Logger(String name, String resourceBundleName, Class<?> caller, LogManager manager, boolean isSystemLogger) {
+    Logger(String name, String resourceBundleName, Module caller,
+           LogManager manager, boolean isSystemLogger) {
         this.manager = manager;
         this.isSystemLogger = isSystemLogger;
         setupResourceInfo(resourceBundleName, caller);
@@ -387,10 +389,7 @@
         levelValue = Level.INFO.intValue();
     }
 
-    private void setCallerModuleRef(Class<?> caller) {
-        Module callerModule = ((caller != null)
-                                        ? caller.getModule()
-                                        : null);
+    private void setCallerModuleRef(Module callerModule) {
         if (callerModule != null) {
             this.callerModuleRef = new WeakReference<>(callerModule);
         }
@@ -618,7 +617,7 @@
         // all loggers in the system context will default to
         // the system logger's resource bundle - therefore the caller won't
         // be needed and can be null.
-        Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME, null);
+        Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME, (Module)null);
         return result;
     }
 
@@ -681,8 +680,10 @@
         LogManager manager = LogManager.getLogManager();
         // cleanup some Loggers that have been GC'ed
         manager.drainLoggerRefQueueBounded();
+        final Class<?> callerClass = Reflection.getCallerClass();
+        final Module module = callerClass.getModule();
         Logger result = new Logger(null, resourceBundleName,
-                                   Reflection.getCallerClass(), manager, false);
+                                   module, manager, false);
         result.anonymous = true;
         Logger root = manager.getLogger("");
         result.doSetParent(root);
@@ -2046,6 +2047,11 @@
         }
     }
 
+    private void setupResourceInfo(String name, Class<?> caller) {
+        final Module module = caller == null ? null : caller.getModule();
+        setupResourceInfo(name, module);
+    }
+
     // Private utility method to initialize our one entry
     // resource bundle name cache and the callers Module
     // Note: for consistency reasons, we are careful to check
@@ -2053,7 +2059,7 @@
     // resourceBundleName field.
     // Synchronized to prevent races in setting the fields.
     private synchronized void setupResourceInfo(String name,
-                                                Class<?> callerClass) {
+                                                Module callerModule) {
         final LoggerBundle lb = loggerBundle;
         if (lb.resourceBundleName != null) {
             // this Logger already has a ResourceBundle
@@ -2072,8 +2078,9 @@
             return;
         }
 
-        setCallerModuleRef(callerClass);
-        if (isSystemLogger && (callerClass != null && callerClass.getClassLoader() != null)) {
+        setCallerModuleRef(callerModule);
+
+        if (isSystemLogger && (callerModule != null && !isSystem(callerModule))) {
             checkPermission();
         }
 
--- a/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -32,6 +32,7 @@
 import java.util.function.Supplier;
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
+import java.lang.reflect.Module;
 import java.util.Objects;
 import java.util.logging.LogManager;
 import jdk.internal.logger.DefaultLoggerFinder;
@@ -398,21 +399,20 @@
     }
 
     /**
-     * Creates a java.util.logging.Logger for the given caller.
+     * Creates a java.util.logging.Logger for the given module.
      * @param name the logger name.
-     * @param caller the caller for which the logger should be created.
-     * @return a Logger suitable for use in the given caller.
+     * @param module the module for which the logger should be created.
+     * @return a Logger suitable for use in the given module.
      */
     private static java.util.logging.Logger demandJULLoggerFor(final String name,
-                                                            /* Module */
-                                                            final Class<?> caller) {
+                                                               Module module) {
         final LogManager manager = LogManager.getLogManager();
         final SecurityManager sm = System.getSecurityManager();
         if (sm == null) {
-            return logManagerAccess.demandLoggerFor(manager, name, caller);
+            return logManagerAccess.demandLoggerFor(manager, name, module);
         } else {
             final PrivilegedAction<java.util.logging.Logger> pa =
-                    () -> logManagerAccess.demandLoggerFor(manager, name, caller);
+                    () -> logManagerAccess.demandLoggerFor(manager, name, module);
             return AccessController.doPrivileged(pa, null, LOGGING_CONTROL_PERMISSION);
         }
     }
@@ -429,17 +429,17 @@
      * {@code RuntimePermission("loggerFinder")}.
      */
     @Override
-    protected Logger demandLoggerFor(String name, /* Module */ Class<?> caller) {
+    protected Logger demandLoggerFor(String name, Module module) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPermission(LOGGERFINDER_PERMISSION);
         }
-        return JULWrapper.of(demandJULLoggerFor(name,caller));
+        return JULWrapper.of(demandJULLoggerFor(name,module));
     }
 
     public static interface LogManagerAccess {
         java.util.logging.Logger demandLoggerFor(LogManager manager,
-                String name, /* Module */ Class<?> caller);
+                String name, Module module);
     }
 
     // Hook for tests
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java	Fri Apr 29 11:54:18 2016 -0700
@@ -61,24 +61,32 @@
         String baseName;
         String extensionName = "";
 
-        int offset = fullName.indexOf('/', 1);
-        if (fullName.length() >= 2 && fullName.charAt(0) == '/' && offset != -1) {
-            moduleName = fullName.substring(1, offset);
-            fullName = fullName.substring(offset + 1);
-        }
+        if (fullName.startsWith("/modules/")) {
+            moduleName = "modules";
+            baseName = fullName.substring("/modules/".length());
+        } else if ( fullName.startsWith("/packages/")) {
+            moduleName = "packages";
+            baseName = fullName.substring("/packages/".length());
+        } else {
+            int offset = fullName.indexOf('/', 1);
+            if (fullName.length() >= 2 && fullName.charAt(0) == '/' && offset != -1) {
+                moduleName = fullName.substring(1, offset);
+                fullName = fullName.substring(offset + 1);
+            }
 
-        offset = fullName.lastIndexOf('/');
-        if (1 < offset) {
-            parentName = fullName.substring(0, offset);
-            fullName = fullName.substring(offset + 1);
-        }
+            offset = fullName.lastIndexOf('/');
+            if (1 < offset) {
+                parentName = fullName.substring(0, offset);
+                fullName = fullName.substring(offset + 1);
+            }
 
-        offset = fullName.lastIndexOf('.');
-        if (offset != -1) {
-            baseName = fullName.substring(0, offset);
-            extensionName = fullName.substring(offset + 1);
-        } else {
-            baseName = fullName;
+            offset = fullName.lastIndexOf('.');
+            if (offset != -1) {
+                baseName = fullName.substring(0, offset);
+                extensionName = fullName.substring(offset + 1);
+            } else {
+                baseName = fullName;
+            }
         }
 
         return new ImageLocationWriter(strings)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2016, 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 jdk.tools.jlink.internal.packager;
+
+
+import jdk.tools.jlink.Jlink;
+import jdk.tools.jlink.builder.ImageBuilder;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.builder.*;
+import jdk.tools.jlink.plugin.Pool;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+
+/**
+ * AppRuntimeImageBuilder is a private API used only by the Java Packager to generate
+ * a Java runtime image using jlink. AppRuntimeImageBuilder encapsulates the
+ * arguments that jlink requires to generate this image. To create the image call the
+ * build() method.
+ */
+public final class AppRuntimeImageBuilder {
+    private Path outputDir = null;
+    private List<Path> modulePath = null;
+    private Set<String> addModules = null;
+    private Set<String> limitModules = null;
+    private String excludeFileList = null;
+    private Map<String, String> userArguments = null;
+    private Boolean stripNativeCommands = null;
+
+    public AppRuntimeImageBuilder() {}
+
+    public void setOutputDir(Path value) {
+        outputDir = value;
+    }
+
+    public void setModulePath(List<Path> value) {
+        modulePath = value;
+    }
+
+    public void setAddModules(Set<String> value) {
+        addModules = value;
+    }
+
+    public void setLimitModules(Set<String> value) {
+        limitModules = value;
+    }
+
+    public void setExcludeFileList(String value) {
+        excludeFileList = value;
+    }
+
+    public void setStripNativeCommands(boolean value) {
+        stripNativeCommands = value;
+    }
+
+    public void setUserArguments(Map<String, String> value) {
+        userArguments = value;
+    }
+
+    public void build() throws IOException {
+        // jlink main arguments
+        Jlink.JlinkConfiguration jlinkConfig = new Jlink.JlinkConfiguration(
+            new File("").toPath(), // Unused
+            modulePath, addModules, limitModules);
+
+        // plugin configuration
+        List<Plugin> plugins = new ArrayList<Plugin>();
+
+        if (stripNativeCommands) {
+            plugins.add(Jlink.newPlugin(
+                        "strip-native-commands",
+                        Collections.singletonMap("strip-native-commands", "on"),
+                        null));
+        }
+
+        if (excludeFileList != null && !excludeFileList.isEmpty()) {
+            plugins.add(Jlink.newPlugin(
+                        "exclude-files",
+                        Collections.singletonMap("exclude-files", excludeFileList),
+                        null));
+        }
+
+        // add user supplied jlink arguments
+        for (Map.Entry<String, String> entry : userArguments.entrySet()) {
+            String key = entry.getKey();
+            String value = entry.getValue();
+            plugins.add(Jlink.newPlugin(key,
+                                        Collections.singletonMap(key, value),
+                                        null));
+        }
+
+        plugins.add(Jlink.newPlugin("installed-modules", Collections.emptyMap(), null));
+
+        // build the image
+        Jlink.PluginsConfiguration pluginConfig = new Jlink.PluginsConfiguration(
+            plugins, new DefaultImageBuilder(true, outputDir), null);
+        Jlink jlink = new Jlink();
+        jlink.build(jlinkConfig, pluginConfig);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/module-info.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+module jdk.jstatd {
+    requires java.rmi;
+    requires jdk.jvmstat;
+
+    // RMI needs to serialize types in this package
+    exports sun.jvmstat.monitor.remote to java.rmi;
+
+    provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/monitor/remote/RemoteHost.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004, 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.jvmstat.monitor.remote;
+
+import sun.jvmstat.monitor.*;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.io.IOException;
+
+/**
+ * Remote Interface for discovering and attaching to remote
+ * monitorable Java Virtual Machines.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public interface RemoteHost extends Remote {
+
+    /**
+     * Remote method to attach to a remote HotSpot Java Virtual Machine
+     * identified by <code>vmid</code>.
+     *
+     * @param vmid The identifier for the target virtual machine.
+     * @return RemoteVm - A remote object for accessing the remote Java
+     *                    Virtual Machine.
+     *
+     * @throws MonitorException Thrown when any other error is encountered
+     *                          while communicating with the target virtual
+     *                          machine.
+     * @throws RemoteException
+     *
+     */
+    RemoteVm attachVm(int vmid, String mode) throws RemoteException,
+                                                    MonitorException;
+
+    /**
+     * Remote method to detach from a remote HotSpot Java Virtual Machine
+     * identified by <code>vmid</code>.
+     *
+     * @param rvm The remote object for the target Java Virtual
+     *            Machine.
+     *
+     * @throws MonitorException Thrown when any other error is encountered
+     *                          while communicating with the target virtual
+     *                          machine.
+     * @throws RemoteException
+     */
+    void detachVm(RemoteVm rvm) throws RemoteException, MonitorException;
+
+    /**
+     * Get a list of Local Virtual Machine Identifiers for the active
+     * Java Virtual Machine the remote system. A Local Virtual Machine
+     * Identifier is also known as an <em>lvmid</em>.
+     *
+     * @return int[] - A array of <em>lvmid</em>s.
+     * @throws MonitorException Thrown when any other error is encountered
+     *                          while communicating with the target virtual
+     *                          machine.
+     * @throws RemoteException
+     */
+    int[] activeVms() throws RemoteException, MonitorException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2004, 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.jvmstat.monitor.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Interface for accessing the instrumentation exported by a
+ * Java Virtual Machine running on a remote host.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public interface RemoteVm extends Remote {
+
+    /**
+     * Interface to get the bytes associated with the instrumentation
+     * for the remote Java Virtual Machine.
+     *
+     * @return byte[] - a byte array containing the current bytes
+     *                  for the instrumentation exported by the
+     *                  remote Java Virtual Machine.
+     * @throws RemoteException Thrown on any communication error
+     */
+    byte[] getBytes() throws RemoteException;
+
+    /**
+     * Interface to get the size of the instrumentation buffer
+     * for the target Java Virtual Machine.
+     *
+     * @return int - the size of the instrumentation buffer for the
+     *               remote Java Virtual Machine.
+     * @throws RemoteException Thrown on any communication error
+     */
+    int getCapacity() throws RemoteException;
+
+    /**
+     * Interface to return the Local Virtual Machine Identifier for
+     * the remote Java Virtual Machine. The Local Virtual Machine
+     * Identifier is also know as the <em>lvmid</em>.
+     *
+     * @throws RemoteException Thrown on any communication error
+     */
+    int getLocalVmId() throws RemoteException;
+
+    /**
+     * Interface to detach from the remote Java Virtual Machine.
+     *
+     * @throws RemoteException Thrown on any communication error
+     */
+    void detach() throws RemoteException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/monitor/remote/package.html	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,39 @@
+<!doctype html public "-//IETF//DTD HTML/EN">
+<html>
+<head>
+<!--
+ 
+
+ Copyright (c) 2004, 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.
+
+
+-->
+</head>
+<body bgcolor="white">
+<p>
+Provides interfaces supporting remote monitoring for instrumented
+HotSpot Java Virtual Machines.
+</p>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.perfdata.monitor.protocol.rmi;
+
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.event.*;
+import sun.jvmstat.monitor.remote.*;
+import sun.jvmstat.perfdata.monitor.*;
+import java.util.*;
+import java.net.*;
+import java.io.*;
+import java.rmi.*;
+import java.util.HashMap;
+
+/**
+ * Concrete implementation of the MonitoredHost interface for the
+ * <em>rmi</em> protocol of the HotSpot PerfData monitoring implementation.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class MonitoredHostProvider extends MonitoredHost {
+    private static final String serverName = "/JStatRemoteHost";
+    private static final int DEFAULT_POLLING_INTERVAL = 1000;
+
+    private ArrayList<HostListener> listeners;
+    private NotifierTask task;
+    private HashSet<Integer> activeVms;
+    private RemoteVmManager vmManager;
+    private RemoteHost remoteHost;
+    private Timer timer;
+
+    /**
+     * Create a MonitoredHostProvider instance using the given HostIdentifier.
+     *
+     * @param hostId the host identifier for this MonitoredHost
+     * @throws MonitorException Thrown on any error encountered while
+     *                          communicating with the remote host.
+     */
+    public MonitoredHostProvider(HostIdentifier hostId)
+           throws MonitorException {
+        this.hostId = hostId;
+        this.listeners = new ArrayList<HostListener>();
+        this.interval = DEFAULT_POLLING_INTERVAL;
+        this.activeVms = new HashSet<Integer>();
+
+        String rmiName;
+        String sn = serverName;
+        String path = hostId.getPath();
+
+        if ((path != null) && (path.length() > 0)) {
+            sn = path;
+        }
+
+        if (hostId.getPort() != -1) {
+            rmiName = "rmi://" + hostId.getHost() + ":" + hostId.getPort() + sn;
+        } else {
+            rmiName = "rmi://" + hostId.getHost() + sn;
+        }
+
+        try {
+            remoteHost = (RemoteHost)Naming.lookup(rmiName);
+
+        } catch (RemoteException e) {
+            /*
+             * rmi registry not available
+             *
+             * Access control exceptions, where the rmi server refuses a
+             * connection based on policy file configuration, come through
+             * here on the client side. Unfortunately, the RemoteException
+             * doesn't contain enough information to determine the true cause
+             * of the exception. So, we have to output a rather generic message.
+             */
+            String message = "RMI Registry not available at "
+                             + hostId.getHost();
+
+            if (hostId.getPort() == -1) {
+                message = message + ":"
+                          + java.rmi.registry.Registry.REGISTRY_PORT;
+            } else {
+                message = message + ":" + hostId.getPort();
+            }
+
+            if (e.getMessage() != null) {
+                throw new MonitorException(message + "\n" + e.getMessage(), e);
+            } else {
+                throw new MonitorException(message, e);
+            }
+
+        } catch (NotBoundException e) {
+            // no server with given name
+            String message = e.getMessage();
+            if (message == null) message = rmiName;
+            throw new MonitorException("RMI Server " + message
+                                       + " not available", e);
+        } catch (MalformedURLException e) {
+            // this is a programming problem
+            e.printStackTrace();
+            throw new IllegalArgumentException("Malformed URL: " + rmiName);
+        }
+        this.vmManager = new RemoteVmManager(remoteHost);
+        this.timer = new Timer(true);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public MonitoredVm getMonitoredVm(VmIdentifier vmid)
+                       throws MonitorException {
+        return getMonitoredVm(vmid, DEFAULT_POLLING_INTERVAL);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public MonitoredVm getMonitoredVm(VmIdentifier vmid, int interval)
+                       throws MonitorException {
+        VmIdentifier nvmid = null;
+        try {
+            nvmid = hostId.resolve(vmid);
+            RemoteVm rvm = remoteHost.attachVm(vmid.getLocalVmId(),
+                                               vmid.getMode());
+            RemoteMonitoredVm rmvm = new RemoteMonitoredVm(rvm, nvmid, timer,
+                                                           interval);
+            rmvm.attach();
+            return rmvm;
+
+        } catch (RemoteException e) {
+            throw new MonitorException("Remote Exception attaching to "
+                                       + nvmid.toString(), e);
+        } catch (URISyntaxException e) {
+            /*
+             * the VmIdentifier is expected to be a valid and should resolve
+             * easonably against the host identifier. A URISyntaxException
+             * here is most likely a programming error.
+             */
+            throw new IllegalArgumentException("Malformed URI: "
+                                               + vmid.toString(), e);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void detach(MonitoredVm vm) throws MonitorException {
+        RemoteMonitoredVm rmvm = (RemoteMonitoredVm)vm;
+        rmvm.detach();
+        try {
+            remoteHost.detachVm(rmvm.getRemoteVm());
+
+        } catch (RemoteException e) {
+            throw new MonitorException("Remote Exception detaching from "
+                                       + vm.getVmIdentifier().toString(), e);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addHostListener(HostListener listener) {
+        synchronized(listeners) {
+            listeners.add(listener);
+            if (task == null) {
+                task = new NotifierTask();
+                timer.schedule(task, 0, interval);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void removeHostListener(HostListener listener) {
+        /*
+         * XXX: if a disconnect method is added, make sure it calls
+         * this method to unregister this object from the watcher. otherwise,
+         * an unused MonitoredHostProvider instance may go uncollected.
+         */
+        synchronized(listeners) {
+            listeners.remove(listener);
+            if (listeners.isEmpty() && (task != null)) {
+                task.cancel();
+                task = null;
+            }
+        }
+    }
+
+    public void setInterval(int newInterval) {
+        synchronized(listeners) {
+            if (newInterval == interval) {
+                return;
+            }
+
+            int oldInterval = interval;
+            super.setInterval(newInterval);
+
+            if (task != null) {
+                task.cancel();
+                NotifierTask oldTask = task;
+                task = new NotifierTask();
+                CountedTimerTaskUtils.reschedule(timer, oldTask, task,
+                                                 oldInterval, newInterval);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<Integer> activeVms() throws MonitorException {
+        return vmManager.activeVms();
+    }
+
+    /**
+     * Fire VmStatusChangeEvent events to HostListener objects
+     *
+     * @param active Set of Integer objects containing the local
+     *               Vm Identifiers of the active JVMs
+     * @param started Set of Integer objects containing the local
+     *                Vm Identifiers of new JVMs started since last
+     *                interval.
+     * @param terminated Set of Integer objects containing the local
+     *                   Vm Identifiers of terminated JVMs since last
+     *                   interval.
+     */
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    private void fireVmStatusChangedEvents(Set<Integer> active, Set<Integer> started,
+                                           Set<Integer> terminated) {
+        ArrayList<HostListener> registered = null;
+        VmStatusChangeEvent ev = null;
+
+        synchronized(listeners) {
+            registered = (ArrayList)listeners.clone();
+        }
+
+        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            HostListener l = i.next();
+            if (ev == null) {
+                ev = new VmStatusChangeEvent(this, active, started, terminated);
+            }
+            l.vmStatusChanged(ev);
+        }
+    }
+
+    /**
+     * Fire hostDisconnectEvent events.
+     */
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    void fireDisconnectedEvents() {
+        ArrayList<HostListener> registered = null;
+        HostEvent ev = null;
+
+        synchronized(listeners) {
+            registered = (ArrayList)listeners.clone();
+        }
+
+        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            HostListener l = i.next();
+            if (ev == null) {
+                ev = new HostEvent(this);
+            }
+            l.disconnected(ev);
+        }
+    }
+
+    /**
+     * class to poll the remote machine and generate local event notifications.
+     */
+    private class NotifierTask extends CountedTimerTask {
+        public void run() {
+            super.run();
+
+            // save the last set of active JVMs
+            Set<Integer> lastActiveVms = activeVms;
+
+            try {
+                // get the current set of active JVMs
+                activeVms = (HashSet<Integer>)vmManager.activeVms();
+
+            } catch (MonitorException e) {
+                // XXX: use logging api
+                System.err.println("MonitoredHostProvider: polling task "
+                                   + "caught MonitorException:");
+                e.printStackTrace();
+
+                // mark the HostManager as errored and notify listeners
+                setLastException(e);
+                fireDisconnectedEvents();
+            }
+
+            if (activeVms.isEmpty()) {
+                return;
+            }
+
+            Set<Integer> startedVms = new HashSet<>();
+            Set<Integer> terminatedVms = new HashSet<>();
+
+            for (Iterator<Integer> i = activeVms.iterator(); i.hasNext(); /* empty */ ) {
+                Integer vmid = i.next();
+                if (!lastActiveVms.contains(vmid)) {
+                    // a new file has been detected, add to set
+                    startedVms.add(vmid);
+                }
+            }
+
+            for (Iterator<Integer> i = lastActiveVms.iterator(); i.hasNext();
+                    /* empty */ ) {
+                Integer o = i.next();
+                if (!activeVms.contains(o)) {
+                    // JVM has terminated, remove it from the active list
+                    terminatedVms.add(o);
+                }
+            }
+
+            if (!startedVms.isEmpty() || !terminatedVms.isEmpty()) {
+                fireVmStatusChangedEvents(activeVms, startedVms, terminatedVms);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.perfdata.monitor.protocol.rmi;
+
+import sun.jvmstat.monitor.HostIdentifier;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredHostService;
+
+public final class MonitoredHostRmiService implements MonitoredHostService {
+
+    @Override
+    public MonitoredHost getMonitoredHost(HostIdentifier hostId) throws MonitorException {
+        return new MonitoredHostProvider(hostId);
+    }
+
+    @Override
+    public String getScheme() {
+        return "rmi";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/PerfDataBuffer.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2004, 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.jvmstat.perfdata.monitor.protocol.rmi;
+
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.remote.*;
+import sun.jvmstat.perfdata.monitor.*;
+import java.io.*;
+import java.rmi.RemoteException;
+import java.nio.ByteBuffer;
+
+/**
+ * The concrete PerfDataBuffer implementation for the <em>rmi:</em>
+ * protocol for the HotSpot PerfData monitoring implementation.
+ * <p>
+ * This class is responsible for acquiring the instrumentation buffer
+ * data for a remote target HotSpot Java Virtual Machine.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class PerfDataBuffer extends AbstractPerfDataBuffer {
+
+    private RemoteVm rvm;
+
+    /**
+     * Create a PerfDataBuffer instance for accessing the specified
+     * instrumentation buffer.
+     *
+     * @param rvm the proxy to the remote MonitredVm object
+     * @param lvmid the local Java Virtual Machine Identifier of the
+     *              remote target.
+     *
+     * @throws MonitorException
+     */
+    public PerfDataBuffer(RemoteVm rvm, int lvmid) throws MonitorException {
+
+        this.rvm = rvm;
+        try {
+            ByteBuffer buffer = ByteBuffer.allocate(rvm.getCapacity());
+            sample(buffer);
+            createPerfDataBuffer(buffer, lvmid);
+
+        } catch (RemoteException e) {
+            throw new MonitorException("Could not read data for remote JVM "
+                                       + lvmid, e);
+        }
+    }
+
+    /**
+     * Get a copy of the remote instrumentation buffer.
+     *<p>
+     * The data in the remote instrumentation buffer is copied into
+     * the local byte buffer.
+     *
+     * @param buffer the buffer to receive the copy of the remote
+     *               instrumentation buffer.
+     * @throws RemoteException Thrown on any communications errors with
+     *                         the remote system.
+     */
+    public void sample(ByteBuffer buffer) throws RemoteException {
+        assert buffer != null;
+        assert rvm != null;
+        synchronized(buffer) {
+            buffer.clear();
+            buffer.put(rvm.getBytes());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.perfdata.monitor.protocol.rmi;
+
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.event.*;
+import sun.jvmstat.monitor.remote.*;
+import sun.jvmstat.perfdata.monitor.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.rmi.*;
+
+/**
+ * Concrete implementation of the AbstractMonitoredVm class for the
+ * <em>rmi:</em> protocol for the HotSpot PerfData monitoring implementation.
+ * <p>
+ * This class provides the ability to acquire to the instrumentation buffer
+ * of a live, remote target Java Virtual Machine through an RMI server.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteMonitoredVm extends AbstractMonitoredVm {
+
+    private ArrayList<VmListener> listeners;
+    private NotifierTask notifierTask;
+    private SamplerTask samplerTask;
+    private Timer timer;
+
+    private RemoteVm rvm;
+    private ByteBuffer updateBuffer;
+
+    /**
+     * Create a RemoteMonitoredVm instance.
+     *
+     * @param rvm the proxy to the remote MonitoredVm instance.
+     * @param vmid the vm identifier specifying the remot target JVM
+     * @param timer the timer used to run polling tasks
+     * @param interval the sampling interval
+     */
+    public RemoteMonitoredVm(RemoteVm rvm, VmIdentifier vmid,
+                             Timer timer, int interval)
+           throws MonitorException {
+        super(vmid, interval);
+        this.rvm = rvm;
+        pdb = new PerfDataBuffer(rvm, vmid.getLocalVmId());
+        this.listeners = new ArrayList<VmListener>();
+        this.timer = timer;
+    }
+
+    /**
+     * Method to attach to the remote MonitoredVm.
+     */
+    public void attach() throws MonitorException {
+        updateBuffer = pdb.getByteBuffer().duplicate();
+
+        // if continuous sampling is requested, register with the sampler thread
+        if (interval > 0) {
+            samplerTask = new SamplerTask();
+            timer.schedule(samplerTask, 0, interval);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void detach() {
+        try {
+            if (interval > 0) {
+                if (samplerTask != null) {
+                    samplerTask.cancel();
+                    samplerTask = null;
+                }
+                if (notifierTask != null) {
+                    notifierTask.cancel();
+                    notifierTask = null;
+                }
+                sample();
+            }
+        } catch (RemoteException e) {
+            // XXX: - use logging api? throw an exception instead?
+            System.err.println("Could not read data for remote JVM " + vmid);
+            e.printStackTrace();
+
+        } finally {
+            super.detach();
+        }
+    }
+
+    /**
+     * Get a copy of the remote instrumentation buffer.
+     *<p>
+     * The data in the remote instrumentation buffer is copied into
+     * a local byte buffer.
+     *
+     * @throws RemoteException Thrown on any communications errors with
+     *                         the remote system.
+     */
+    public void sample() throws RemoteException {
+        assert updateBuffer != null;
+        ((PerfDataBuffer)pdb).sample(updateBuffer);
+    }
+
+    /**
+     * Get the proxy to the remote MonitoredVm.
+     *
+     * @return RemoteVm - the proxy to the remote MonitoredVm.
+     */
+    public RemoteVm getRemoteVm() {
+        return rvm;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addVmListener(VmListener l) {
+        synchronized(listeners) {
+            listeners.add(l);
+            if (notifierTask == null) {
+                notifierTask = new NotifierTask();
+                timer.schedule(notifierTask, 0, interval);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void removeVmListener(VmListener l) {
+        synchronized(listeners) {
+            listeners.remove(l);
+            if (listeners.isEmpty() && (notifierTask != null)) {
+                notifierTask.cancel();
+                notifierTask = null;
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setInterval(int newInterval) {
+        synchronized(listeners) {
+            if (newInterval == interval) {
+                return;
+            }
+
+            int oldInterval = interval;
+            super.setInterval(newInterval);
+
+            if (samplerTask != null) {
+                samplerTask.cancel();
+                SamplerTask oldSamplerTask = samplerTask;
+                samplerTask = new SamplerTask();
+                CountedTimerTaskUtils.reschedule(timer, oldSamplerTask,
+                                                 samplerTask, oldInterval,
+                                                 newInterval);
+            }
+            if (notifierTask != null) {
+                notifierTask.cancel();
+                NotifierTask oldNotifierTask = notifierTask;
+                notifierTask = new NotifierTask();
+                CountedTimerTaskUtils.reschedule(timer, oldNotifierTask,
+                                                 notifierTask, oldInterval,
+                                                 newInterval);
+            }
+        }
+    }
+
+    /**
+     * Fire MonitoredVmStructureChanged events.
+     *
+     * @param inserted List of Monitor objects inserted.
+     * @param removed List of Monitor objects removed.
+     */
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    void fireMonitorStatusChangedEvents(List<Monitor> inserted, List<Monitor> removed) {
+        ArrayList<VmListener> registered = null;
+        MonitorStatusChangeEvent ev = null;
+
+        synchronized(listeners) {
+            registered = (ArrayList)listeners.clone();
+        }
+
+        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            VmListener l = i.next();
+            if (ev == null) {
+                ev = new MonitorStatusChangeEvent(this, inserted, removed);
+            }
+            l.monitorStatusChanged(ev);
+        }
+    }
+
+    /**
+     * Fire MonitoredVmStructureChanged events.
+     */
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    void fireMonitorsUpdatedEvents() {
+        ArrayList<VmListener> registered = null;
+        VmEvent ev = null;
+
+        synchronized(listeners) {
+            registered = (ArrayList)listeners.clone();
+        }
+
+        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            VmListener l = i.next();
+            if (ev == null) {
+                ev = new VmEvent(this);
+            }
+            l.monitorsUpdated(ev);
+        }
+    }
+
+    /*
+     * Timer Tasks. There are two separate timer tasks here. The SamplerTask
+     * is active whenever we are attached to the remote JVM with a periodic
+     * sampling interval > 0. The NotifierTask is only active if a VmListener
+     * has registered with this RemoteMonitoredVm instance. Also, in the future
+     * we may want to run these tasks at different intervals. Currently,
+     * they run at the same interval and some significant work may
+     * need to be done to complete the separation of these two intervals.
+     */
+
+    /**
+     * Class to periodically check the state of the defined monitors
+     * for the remote MonitoredVm instance and to notify listeners of
+     * any detected changes.
+     */
+    private class NotifierTask extends CountedTimerTask {
+        public void run() {
+            super.run();
+            try {
+                MonitorStatus status = getMonitorStatus();
+
+                List<Monitor> inserted = status.getInserted();
+                List<Monitor> removed = status.getRemoved();
+
+                if (!inserted.isEmpty() || !removed.isEmpty()) {
+                    fireMonitorStatusChangedEvents(inserted, removed);
+                }
+            } catch (MonitorException e) {
+                // XXX: use logging api? fire disconnect events? mark errored?
+                // fireDisconnectedEvents();
+                System.err.println("Exception updating monitors for "
+                                   + getVmIdentifier());
+                e.printStackTrace();
+                // XXX: should we cancle the notifierTask here?
+                // this.cancel();
+            }
+        }
+    }
+
+    /**
+     * Class to periodically sample the remote instrumentation byte buffer
+     * and refresh the local copy. Registered listeners are notified of
+     * the completion of a sampling event.
+     */
+    private class SamplerTask extends CountedTimerTask {
+        public void run() {
+            super.run();
+            try {
+                sample();
+                fireMonitorsUpdatedEvents();
+
+            } catch (RemoteException e) {
+                // XXX: use logging api, mark vm as errored.
+                System.err.println("Exception taking sample for "
+                                   + getVmIdentifier());
+                e.printStackTrace();
+                this.cancel();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteVmManager.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2004, 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.jvmstat.perfdata.monitor.protocol.rmi;
+
+import java.util.*;
+import java.util.regex.*;
+import java.io.*;
+import java.rmi.RemoteException;
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.event.*;
+import sun.jvmstat.monitor.remote.*;
+
+/**
+ * Class for managing the RemoteMonitoredVm instances on a remote system.
+ * <p>
+ * This class is responsible for the mechanism that detects the active
+ * HotSpot Java Virtual Machines on the remote host and possibly for a
+ * specific user. The ability to detect all possible HotSpot Java Virtual
+ * Machines on the remote host may be limited by the permissions of the
+ * principal running the RMI server application on the remote host.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteVmManager {
+
+    private RemoteHost remoteHost;
+    private String user;
+
+    /**
+     * Creates a RemoteVmManager instance for the remote system.
+     * <p>
+     * Manages RemoteMonitordVm instances for which the principal
+     * running the remote server has appropriate permissions.
+     *
+     * @param remoteHost the remote proxy object to the RMI server on
+     *                   the remote system.
+     */
+    public RemoteVmManager(RemoteHost remoteHost) {
+        this(remoteHost, null);
+    }
+
+    /**
+     * Creates a RemoteVmManager instance for the given user.
+     * <p>
+     * Manages RemoteMonitoredVm instances for all remote Java Virtual
+     * machines owned by the specified user on the remote system. The
+     * RMI server on the remote system must have the appropriate permissions
+     * to access the named users Java Virtual Machines.
+     *
+     * @param remoteHost the remote proxy object to the RMI server on
+     *                   the remote system.
+     * @param user the name of the user
+     */
+    public RemoteVmManager(RemoteHost remoteHost, String user) {
+        this.user = user;
+        this.remoteHost = remoteHost;
+    }
+
+    /**
+     * Return the current set of monitorable Java Virtual Machines.
+     * <p>
+     * The set returned by this method depends on the user name passed
+     * to the constructor. If no user name was specified, then this
+     * method will return all candidate JVMs on the system. Otherwise,
+     * only the JVMs for the given user will be returned. This assumes
+     * that the RMI server process has the appropriate permissions to
+     * access the target set of JVMs.
+     *
+     * @return Set - the Set of monitorable Java Virtual Machines
+     */
+    public Set<Integer> activeVms() throws MonitorException {
+        int[] active = null;
+
+        try {
+            active = remoteHost.activeVms();
+
+        } catch (RemoteException e) {
+            throw new MonitorException("Error communicating with remote host: "
+                                       + e.getMessage(), e);
+        }
+
+        Set<Integer> activeSet = new HashSet<Integer>(active.length);
+
+        for (int i = 0; i < active.length; i++) {
+            activeSet.add(active[i]);
+        }
+
+        return activeSet;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/package.html	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,47 @@
+<!doctype html public "-//IETF//DTD HTML/EN">
+<html>
+<head>
+<!--
+ 
+
+ Copyright (c) 2004, 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.
+
+-->
+</head>
+<body bgcolor="white">
+<p>
+Provides the implementation classes for the <em>rmi:</em> protocol for
+the HotSpot PerfData instrumentation buffer monitoring implementation.
+</p>
+<p>
+The <em>rmi:</em> protocol is the default protocol for the PerfData
+implementation when a hostname is specified as part of a HostIdentifier
+or VMIdentifier. It communicates with an RMI server on the remote machine
+that provides functions to get a list of available Java Virtual Machines
+and to acquire a copy of a Java Virtual Machine's instrumentation buffer.
+The RMI server may or may not use the PerfData implementation on the
+remote host to acquire this information. The <em>jstatd</em> server
+provides a PerfData implementation of the RMI server.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2004, 2015, 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.tools.jstatd;
+
+import java.rmi.*;
+import java.rmi.server.*;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+import java.net.MalformedURLException;
+import sun.jvmstat.monitor.remote.*;
+
+/**
+ * Application providing remote access to the jvmstat instrumentation
+ * exported by local Java Virtual Machine processes. Remote access is
+ * provided through an RMI interface.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class Jstatd {
+
+    private static Registry registry;
+    private static int port = -1;
+    private static boolean startRegistry = true;
+
+    private static void printUsage() {
+        System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]");
+    }
+
+    static void bind(String name, RemoteHostImpl remoteHost)
+                throws RemoteException, MalformedURLException, Exception {
+
+        try {
+            Naming.rebind(name, remoteHost);
+        } catch (java.rmi.ConnectException e) {
+            /*
+             * either the registry is not running or we cannot contact it.
+             * start an internal registry if requested.
+             */
+            if (startRegistry && registry == null) {
+                int localport = (port < 0) ? Registry.REGISTRY_PORT : port;
+                registry = LocateRegistry.createRegistry(localport);
+                bind(name, remoteHost);
+            } else {
+                throw e;
+            }
+        }
+    }
+
+    @SuppressWarnings("deprecation") // Use of RMISecurityManager
+    public static void main(String[] args) {
+        String rminame = null;
+        int argc = 0;
+
+        for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
+            String arg = args[argc];
+
+            if (arg.compareTo("-nr") == 0) {
+                startRegistry = false;
+            } else if (arg.startsWith("-p")) {
+                if (arg.compareTo("-p") != 0) {
+                    port = Integer.parseInt(arg.substring(2));
+                } else {
+                  argc++;
+                  if (argc >= args.length) {
+                      printUsage();
+                      System.exit(1);
+                  }
+                  port = Integer.parseInt(args[argc]);
+                }
+            } else if (arg.startsWith("-n")) {
+                if (arg.compareTo("-n") != 0) {
+                    rminame = arg.substring(2);
+                } else {
+                    argc++;
+                    if (argc >= args.length) {
+                        printUsage();
+                        System.exit(1);
+                    }
+                    rminame = args[argc];
+                }
+            } else {
+                printUsage();
+                System.exit(1);
+            }
+        }
+
+        if (argc < args.length) {
+            printUsage();
+            System.exit(1);
+        }
+
+        if (System.getSecurityManager() == null) {
+            System.setSecurityManager(new RMISecurityManager());
+        }
+
+        StringBuilder name = new StringBuilder();
+
+        if (port >= 0) {
+            name.append("//:").append(port);
+        }
+
+        if (rminame == null) {
+            rminame = "JStatRemoteHost";
+        }
+
+        name.append("/").append(rminame);
+
+        try {
+            // use 1.5.0 dynamically generated subs.
+            System.setProperty("java.rmi.server.ignoreSubClasses", "true");
+            RemoteHostImpl remoteHost = new RemoteHostImpl();
+            RemoteHost stub = (RemoteHost) UnicastRemoteObject.exportObject(
+                    remoteHost, 0);
+            bind(name.toString(), remoteHost);
+            System.out.println("jstatd started (bound to " + name.toString() + ")");
+            System.out.flush();
+        } catch (MalformedURLException e) {
+            if (rminame != null) {
+                System.out.println("Bad RMI server name: " + rminame);
+            } else {
+                System.out.println("Bad RMI URL: " + name);
+            }
+            e.printStackTrace(System.out);
+            System.exit(1);
+        } catch (java.rmi.ConnectException e) {
+            // could not attach to or create a registry
+            System.out.println("Could not contact RMI registry");
+            e.printStackTrace(System.out);
+            System.exit(1);
+        } catch (RemoteException e) {
+            System.out.println("Could not bind " + name + " to RMI Registry");
+            e.printStackTrace(System.out);
+            System.exit(1);
+        } catch (Exception e) {
+            System.out.println("Could not create remote object");
+            e.printStackTrace(System.out);
+            System.exit(1);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/tools/jstatd/RemoteHostImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2004, 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.tools.jstatd;
+
+import java.util.*;
+import java.nio.*;
+import java.io.*;
+import java.net.*;
+import java.rmi.*;
+import java.rmi.server.*;
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.event.*;
+import sun.jvmstat.monitor.remote.*;
+
+/**
+ * Concrete implementation of the RemoteHost interface for the HotSpot
+ * PerfData <em>rmi:</em> protocol.
+ * <p>
+ * This class provides remote access to the instrumentation exported
+ * by HotSpot Java Virtual Machines through the PerfData shared memory
+ * interface.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteHostImpl implements RemoteHost, HostListener {
+
+    private MonitoredHost monitoredHost;
+    private Set<Integer> activeVms;
+
+    public RemoteHostImpl() throws MonitorException {
+        try {
+            monitoredHost = MonitoredHost.getMonitoredHost("localhost");
+        } catch (URISyntaxException e) { }
+
+        activeVms = monitoredHost.activeVms();
+        monitoredHost.addHostListener(this);
+    }
+
+    public RemoteVm attachVm(int lvmid, String mode)
+                    throws RemoteException, MonitorException {
+        Integer v = lvmid;
+        RemoteVm stub = null;
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("local://").append(lvmid).append("@localhost");
+        if (mode != null) {
+            sb.append("?mode=").append(mode);
+        }
+
+        String vmidStr = sb.toString();
+
+        try {
+            VmIdentifier vmid = new VmIdentifier(vmidStr);
+            MonitoredVm mvm = monitoredHost.getMonitoredVm(vmid);
+            RemoteVmImpl rvm = new RemoteVmImpl((BufferedMonitoredVm)mvm);
+            stub = (RemoteVm) UnicastRemoteObject.exportObject(rvm, 0);
+        }
+        catch (URISyntaxException e) {
+            throw new RuntimeException("Malformed VmIdentifier URI: "
+                                       + vmidStr, e);
+        }
+        return stub;
+    }
+
+    public void detachVm(RemoteVm rvm) throws RemoteException {
+        rvm.detach();
+    }
+
+    public int[] activeVms() throws MonitorException {
+        Object[] vms = null;
+        int[] vmids = null;
+
+        vms = monitoredHost.activeVms().toArray();
+        vmids = new int[vms.length];
+
+        for (int i = 0; i < vmids.length; i++) {
+            vmids[i] = ((Integer)vms[i]).intValue();
+        }
+        return vmids;
+    }
+
+    public void vmStatusChanged(VmStatusChangeEvent ev) {
+        synchronized(this.activeVms) {
+            activeVms.retainAll(ev.getActive());
+        }
+    }
+
+    public void disconnected(HostEvent ev) {
+        // we only monitor the local host, so this event shouldn't occur.
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jstatd/share/classes/sun/tools/jstatd/RemoteVmImpl.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2004, 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.tools.jstatd;
+
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.remote.*;
+
+/**
+ * Concrete implementation of the RemoteVm interface for the HotSpot PerfData
+ * shared memory implementation of the jvmstat monitoring APIs. This class
+ * providing remote access to the instrumentation exported by a local HotSpot
+ * Java Virtual Machine. The instrumentation buffer is shipped in whole to
+ * the remote machine, which is responsible for parsing and provide access
+ * to the contained data.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteVmImpl implements RemoteVm {
+
+    private BufferedMonitoredVm mvm;
+
+    RemoteVmImpl(BufferedMonitoredVm mvm) {
+        this.mvm = mvm;
+    }
+
+    public byte[] getBytes() {
+        return mvm.getBytes();
+    }
+
+    public int getCapacity() {
+        return mvm.getCapacity();
+    }
+
+    public void detach() {
+        mvm.detach();
+    }
+
+    public int getLocalVmId() {
+        return mvm.getVmIdentifier().getLocalVmId();
+    }
+}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/module-info.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-module jdk.jvmstat.rmi {
-    requires java.rmi;
-    requires jdk.jvmstat;
-
-    // RMI needs to serialize types in this package
-    exports sun.jvmstat.monitor.remote to java.rmi;
-
-    provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService;
-}
-
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteHost.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2004, 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.jvmstat.monitor.remote;
-
-import sun.jvmstat.monitor.*;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.io.IOException;
-
-/**
- * Remote Interface for discovering and attaching to remote
- * monitorable Java Virtual Machines.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public interface RemoteHost extends Remote {
-
-    /**
-     * Remote method to attach to a remote HotSpot Java Virtual Machine
-     * identified by <code>vmid</code>.
-     *
-     * @param vmid The identifier for the target virtual machine.
-     * @return RemoteVm - A remote object for accessing the remote Java
-     *                    Virtual Machine.
-     *
-     * @throws MonitorException Thrown when any other error is encountered
-     *                          while communicating with the target virtual
-     *                          machine.
-     * @throws RemoteException
-     *
-     */
-    RemoteVm attachVm(int vmid, String mode) throws RemoteException,
-                                                    MonitorException;
-
-    /**
-     * Remote method to detach from a remote HotSpot Java Virtual Machine
-     * identified by <code>vmid</code>.
-     *
-     * @param rvm The remote object for the target Java Virtual
-     *            Machine.
-     *
-     * @throws MonitorException Thrown when any other error is encountered
-     *                          while communicating with the target virtual
-     *                          machine.
-     * @throws RemoteException
-     */
-    void detachVm(RemoteVm rvm) throws RemoteException, MonitorException;
-
-    /**
-     * Get a list of Local Virtual Machine Identifiers for the active
-     * Java Virtual Machine the remote system. A Local Virtual Machine
-     * Identifier is also known as an <em>lvmid</em>.
-     *
-     * @return int[] - A array of <em>lvmid</em>s.
-     * @throws MonitorException Thrown when any other error is encountered
-     *                          while communicating with the target virtual
-     *                          machine.
-     * @throws RemoteException
-     */
-    int[] activeVms() throws RemoteException, MonitorException;
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2004, 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.jvmstat.monitor.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/**
- * Interface for accessing the instrumentation exported by a
- * Java Virtual Machine running on a remote host.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public interface RemoteVm extends Remote {
-
-    /**
-     * Interface to get the bytes associated with the instrumentation
-     * for the remote Java Virtual Machine.
-     *
-     * @return byte[] - a byte array containing the current bytes
-     *                  for the instrumentation exported by the
-     *                  remote Java Virtual Machine.
-     * @throws RemoteException Thrown on any communication error
-     */
-    byte[] getBytes() throws RemoteException;
-
-    /**
-     * Interface to get the size of the instrumentation buffer
-     * for the target Java Virtual Machine.
-     *
-     * @return int - the size of the instrumentation buffer for the
-     *               remote Java Virtual Machine.
-     * @throws RemoteException Thrown on any communication error
-     */
-    int getCapacity() throws RemoteException;
-
-    /**
-     * Interface to return the Local Virtual Machine Identifier for
-     * the remote Java Virtual Machine. The Local Virtual Machine
-     * Identifier is also know as the <em>lvmid</em>.
-     *
-     * @throws RemoteException Thrown on any communication error
-     */
-    int getLocalVmId() throws RemoteException;
-
-    /**
-     * Interface to detach from the remote Java Virtual Machine.
-     *
-     * @throws RemoteException Thrown on any communication error
-     */
-    void detach() throws RemoteException;
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/package.html	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<!doctype html public "-//IETF//DTD HTML/EN">
-<html>
-<head>
-<!--
- 
-
- Copyright (c) 2004, 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.
-
-
--->
-</head>
-<body bgcolor="white">
-<p>
-Provides interfaces supporting remote monitoring for instrumented
-HotSpot Java Virtual Machines.
-</p>
-</body>
-</html>
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.jvmstat.perfdata.monitor.protocol.rmi;
-
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
-import sun.jvmstat.monitor.remote.*;
-import sun.jvmstat.perfdata.monitor.*;
-import java.util.*;
-import java.net.*;
-import java.io.*;
-import java.rmi.*;
-import java.util.HashMap;
-
-/**
- * Concrete implementation of the MonitoredHost interface for the
- * <em>rmi</em> protocol of the HotSpot PerfData monitoring implementation.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class MonitoredHostProvider extends MonitoredHost {
-    private static final String serverName = "/JStatRemoteHost";
-    private static final int DEFAULT_POLLING_INTERVAL = 1000;
-
-    private ArrayList<HostListener> listeners;
-    private NotifierTask task;
-    private HashSet<Integer> activeVms;
-    private RemoteVmManager vmManager;
-    private RemoteHost remoteHost;
-    private Timer timer;
-
-    /**
-     * Create a MonitoredHostProvider instance using the given HostIdentifier.
-     *
-     * @param hostId the host identifier for this MonitoredHost
-     * @throws MonitorException Thrown on any error encountered while
-     *                          communicating with the remote host.
-     */
-    public MonitoredHostProvider(HostIdentifier hostId)
-           throws MonitorException {
-        this.hostId = hostId;
-        this.listeners = new ArrayList<HostListener>();
-        this.interval = DEFAULT_POLLING_INTERVAL;
-        this.activeVms = new HashSet<Integer>();
-
-        String rmiName;
-        String sn = serverName;
-        String path = hostId.getPath();
-
-        if ((path != null) && (path.length() > 0)) {
-            sn = path;
-        }
-
-        if (hostId.getPort() != -1) {
-            rmiName = "rmi://" + hostId.getHost() + ":" + hostId.getPort() + sn;
-        } else {
-            rmiName = "rmi://" + hostId.getHost() + sn;
-        }
-
-        try {
-            remoteHost = (RemoteHost)Naming.lookup(rmiName);
-
-        } catch (RemoteException e) {
-            /*
-             * rmi registry not available
-             *
-             * Access control exceptions, where the rmi server refuses a
-             * connection based on policy file configuration, come through
-             * here on the client side. Unfortunately, the RemoteException
-             * doesn't contain enough information to determine the true cause
-             * of the exception. So, we have to output a rather generic message.
-             */
-            String message = "RMI Registry not available at "
-                             + hostId.getHost();
-
-            if (hostId.getPort() == -1) {
-                message = message + ":"
-                          + java.rmi.registry.Registry.REGISTRY_PORT;
-            } else {
-                message = message + ":" + hostId.getPort();
-            }
-
-            if (e.getMessage() != null) {
-                throw new MonitorException(message + "\n" + e.getMessage(), e);
-            } else {
-                throw new MonitorException(message, e);
-            }
-
-        } catch (NotBoundException e) {
-            // no server with given name
-            String message = e.getMessage();
-            if (message == null) message = rmiName;
-            throw new MonitorException("RMI Server " + message
-                                       + " not available", e);
-        } catch (MalformedURLException e) {
-            // this is a programming problem
-            e.printStackTrace();
-            throw new IllegalArgumentException("Malformed URL: " + rmiName);
-        }
-        this.vmManager = new RemoteVmManager(remoteHost);
-        this.timer = new Timer(true);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public MonitoredVm getMonitoredVm(VmIdentifier vmid)
-                       throws MonitorException {
-        return getMonitoredVm(vmid, DEFAULT_POLLING_INTERVAL);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public MonitoredVm getMonitoredVm(VmIdentifier vmid, int interval)
-                       throws MonitorException {
-        VmIdentifier nvmid = null;
-        try {
-            nvmid = hostId.resolve(vmid);
-            RemoteVm rvm = remoteHost.attachVm(vmid.getLocalVmId(),
-                                               vmid.getMode());
-            RemoteMonitoredVm rmvm = new RemoteMonitoredVm(rvm, nvmid, timer,
-                                                           interval);
-            rmvm.attach();
-            return rmvm;
-
-        } catch (RemoteException e) {
-            throw new MonitorException("Remote Exception attaching to "
-                                       + nvmid.toString(), e);
-        } catch (URISyntaxException e) {
-            /*
-             * the VmIdentifier is expected to be a valid and should resolve
-             * easonably against the host identifier. A URISyntaxException
-             * here is most likely a programming error.
-             */
-            throw new IllegalArgumentException("Malformed URI: "
-                                               + vmid.toString(), e);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void detach(MonitoredVm vm) throws MonitorException {
-        RemoteMonitoredVm rmvm = (RemoteMonitoredVm)vm;
-        rmvm.detach();
-        try {
-            remoteHost.detachVm(rmvm.getRemoteVm());
-
-        } catch (RemoteException e) {
-            throw new MonitorException("Remote Exception detaching from "
-                                       + vm.getVmIdentifier().toString(), e);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void addHostListener(HostListener listener) {
-        synchronized(listeners) {
-            listeners.add(listener);
-            if (task == null) {
-                task = new NotifierTask();
-                timer.schedule(task, 0, interval);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void removeHostListener(HostListener listener) {
-        /*
-         * XXX: if a disconnect method is added, make sure it calls
-         * this method to unregister this object from the watcher. otherwise,
-         * an unused MonitoredHostProvider instance may go uncollected.
-         */
-        synchronized(listeners) {
-            listeners.remove(listener);
-            if (listeners.isEmpty() && (task != null)) {
-                task.cancel();
-                task = null;
-            }
-        }
-    }
-
-    public void setInterval(int newInterval) {
-        synchronized(listeners) {
-            if (newInterval == interval) {
-                return;
-            }
-
-            int oldInterval = interval;
-            super.setInterval(newInterval);
-
-            if (task != null) {
-                task.cancel();
-                NotifierTask oldTask = task;
-                task = new NotifierTask();
-                CountedTimerTaskUtils.reschedule(timer, oldTask, task,
-                                                 oldInterval, newInterval);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Set<Integer> activeVms() throws MonitorException {
-        return vmManager.activeVms();
-    }
-
-    /**
-     * Fire VmStatusChangeEvent events to HostListener objects
-     *
-     * @param active Set of Integer objects containing the local
-     *               Vm Identifiers of the active JVMs
-     * @param started Set of Integer objects containing the local
-     *                Vm Identifiers of new JVMs started since last
-     *                interval.
-     * @param terminated Set of Integer objects containing the local
-     *                   Vm Identifiers of terminated JVMs since last
-     *                   interval.
-     */
-    @SuppressWarnings("unchecked") // Cast of result of clone
-    private void fireVmStatusChangedEvents(Set<Integer> active, Set<Integer> started,
-                                           Set<Integer> terminated) {
-        ArrayList<HostListener> registered = null;
-        VmStatusChangeEvent ev = null;
-
-        synchronized(listeners) {
-            registered = (ArrayList)listeners.clone();
-        }
-
-        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
-            HostListener l = i.next();
-            if (ev == null) {
-                ev = new VmStatusChangeEvent(this, active, started, terminated);
-            }
-            l.vmStatusChanged(ev);
-        }
-    }
-
-    /**
-     * Fire hostDisconnectEvent events.
-     */
-    @SuppressWarnings("unchecked") // Cast of result of clone
-    void fireDisconnectedEvents() {
-        ArrayList<HostListener> registered = null;
-        HostEvent ev = null;
-
-        synchronized(listeners) {
-            registered = (ArrayList)listeners.clone();
-        }
-
-        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
-            HostListener l = i.next();
-            if (ev == null) {
-                ev = new HostEvent(this);
-            }
-            l.disconnected(ev);
-        }
-    }
-
-    /**
-     * class to poll the remote machine and generate local event notifications.
-     */
-    private class NotifierTask extends CountedTimerTask {
-        public void run() {
-            super.run();
-
-            // save the last set of active JVMs
-            Set<Integer> lastActiveVms = activeVms;
-
-            try {
-                // get the current set of active JVMs
-                activeVms = (HashSet<Integer>)vmManager.activeVms();
-
-            } catch (MonitorException e) {
-                // XXX: use logging api
-                System.err.println("MonitoredHostProvider: polling task "
-                                   + "caught MonitorException:");
-                e.printStackTrace();
-
-                // mark the HostManager as errored and notify listeners
-                setLastException(e);
-                fireDisconnectedEvents();
-            }
-
-            if (activeVms.isEmpty()) {
-                return;
-            }
-
-            Set<Integer> startedVms = new HashSet<>();
-            Set<Integer> terminatedVms = new HashSet<>();
-
-            for (Iterator<Integer> i = activeVms.iterator(); i.hasNext(); /* empty */ ) {
-                Integer vmid = i.next();
-                if (!lastActiveVms.contains(vmid)) {
-                    // a new file has been detected, add to set
-                    startedVms.add(vmid);
-                }
-            }
-
-            for (Iterator<Integer> i = lastActiveVms.iterator(); i.hasNext();
-                    /* empty */ ) {
-                Integer o = i.next();
-                if (!activeVms.contains(o)) {
-                    // JVM has terminated, remove it from the active list
-                    terminatedVms.add(o);
-                }
-            }
-
-            if (!startedVms.isEmpty() || !terminatedVms.isEmpty()) {
-                fireVmStatusChangedEvents(activeVms, startedVms, terminatedVms);
-            }
-        }
-    }
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.jvmstat.perfdata.monitor.protocol.rmi;
-
-import sun.jvmstat.monitor.HostIdentifier;
-import sun.jvmstat.monitor.MonitorException;
-import sun.jvmstat.monitor.MonitoredHost;
-import sun.jvmstat.monitor.MonitoredHostService;
-
-public final class MonitoredHostRmiService implements MonitoredHostService {
-
-    @Override
-    public MonitoredHost getMonitoredHost(HostIdentifier hostId) throws MonitorException {
-        return new MonitoredHostProvider(hostId);
-    }
-
-    @Override
-    public String getScheme() {
-        return "rmi";
-    }
-
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/PerfDataBuffer.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2004, 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.jvmstat.perfdata.monitor.protocol.rmi;
-
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.remote.*;
-import sun.jvmstat.perfdata.monitor.*;
-import java.io.*;
-import java.rmi.RemoteException;
-import java.nio.ByteBuffer;
-
-/**
- * The concrete PerfDataBuffer implementation for the <em>rmi:</em>
- * protocol for the HotSpot PerfData monitoring implementation.
- * <p>
- * This class is responsible for acquiring the instrumentation buffer
- * data for a remote target HotSpot Java Virtual Machine.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class PerfDataBuffer extends AbstractPerfDataBuffer {
-
-    private RemoteVm rvm;
-
-    /**
-     * Create a PerfDataBuffer instance for accessing the specified
-     * instrumentation buffer.
-     *
-     * @param rvm the proxy to the remote MonitredVm object
-     * @param lvmid the local Java Virtual Machine Identifier of the
-     *              remote target.
-     *
-     * @throws MonitorException
-     */
-    public PerfDataBuffer(RemoteVm rvm, int lvmid) throws MonitorException {
-
-        this.rvm = rvm;
-        try {
-            ByteBuffer buffer = ByteBuffer.allocate(rvm.getCapacity());
-            sample(buffer);
-            createPerfDataBuffer(buffer, lvmid);
-
-        } catch (RemoteException e) {
-            throw new MonitorException("Could not read data for remote JVM "
-                                       + lvmid, e);
-        }
-    }
-
-    /**
-     * Get a copy of the remote instrumentation buffer.
-     *<p>
-     * The data in the remote instrumentation buffer is copied into
-     * the local byte buffer.
-     *
-     * @param buffer the buffer to receive the copy of the remote
-     *               instrumentation buffer.
-     * @throws RemoteException Thrown on any communications errors with
-     *                         the remote system.
-     */
-    public void sample(ByteBuffer buffer) throws RemoteException {
-        assert buffer != null;
-        assert rvm != null;
-        synchronized(buffer) {
-            buffer.clear();
-            buffer.put(rvm.getBytes());
-        }
-    }
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.jvmstat.perfdata.monitor.protocol.rmi;
-
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
-import sun.jvmstat.monitor.remote.*;
-import sun.jvmstat.perfdata.monitor.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.io.*;
-import java.nio.ByteBuffer;
-import java.rmi.*;
-
-/**
- * Concrete implementation of the AbstractMonitoredVm class for the
- * <em>rmi:</em> protocol for the HotSpot PerfData monitoring implementation.
- * <p>
- * This class provides the ability to acquire to the instrumentation buffer
- * of a live, remote target Java Virtual Machine through an RMI server.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteMonitoredVm extends AbstractMonitoredVm {
-
-    private ArrayList<VmListener> listeners;
-    private NotifierTask notifierTask;
-    private SamplerTask samplerTask;
-    private Timer timer;
-
-    private RemoteVm rvm;
-    private ByteBuffer updateBuffer;
-
-    /**
-     * Create a RemoteMonitoredVm instance.
-     *
-     * @param rvm the proxy to the remote MonitoredVm instance.
-     * @param vmid the vm identifier specifying the remot target JVM
-     * @param timer the timer used to run polling tasks
-     * @param interval the sampling interval
-     */
-    public RemoteMonitoredVm(RemoteVm rvm, VmIdentifier vmid,
-                             Timer timer, int interval)
-           throws MonitorException {
-        super(vmid, interval);
-        this.rvm = rvm;
-        pdb = new PerfDataBuffer(rvm, vmid.getLocalVmId());
-        this.listeners = new ArrayList<VmListener>();
-        this.timer = timer;
-    }
-
-    /**
-     * Method to attach to the remote MonitoredVm.
-     */
-    public void attach() throws MonitorException {
-        updateBuffer = pdb.getByteBuffer().duplicate();
-
-        // if continuous sampling is requested, register with the sampler thread
-        if (interval > 0) {
-            samplerTask = new SamplerTask();
-            timer.schedule(samplerTask, 0, interval);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void detach() {
-        try {
-            if (interval > 0) {
-                if (samplerTask != null) {
-                    samplerTask.cancel();
-                    samplerTask = null;
-                }
-                if (notifierTask != null) {
-                    notifierTask.cancel();
-                    notifierTask = null;
-                }
-                sample();
-            }
-        } catch (RemoteException e) {
-            // XXX: - use logging api? throw an exception instead?
-            System.err.println("Could not read data for remote JVM " + vmid);
-            e.printStackTrace();
-
-        } finally {
-            super.detach();
-        }
-    }
-
-    /**
-     * Get a copy of the remote instrumentation buffer.
-     *<p>
-     * The data in the remote instrumentation buffer is copied into
-     * a local byte buffer.
-     *
-     * @throws RemoteException Thrown on any communications errors with
-     *                         the remote system.
-     */
-    public void sample() throws RemoteException {
-        assert updateBuffer != null;
-        ((PerfDataBuffer)pdb).sample(updateBuffer);
-    }
-
-    /**
-     * Get the proxy to the remote MonitoredVm.
-     *
-     * @return RemoteVm - the proxy to the remote MonitoredVm.
-     */
-    public RemoteVm getRemoteVm() {
-        return rvm;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void addVmListener(VmListener l) {
-        synchronized(listeners) {
-            listeners.add(l);
-            if (notifierTask == null) {
-                notifierTask = new NotifierTask();
-                timer.schedule(notifierTask, 0, interval);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void removeVmListener(VmListener l) {
-        synchronized(listeners) {
-            listeners.remove(l);
-            if (listeners.isEmpty() && (notifierTask != null)) {
-                notifierTask.cancel();
-                notifierTask = null;
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setInterval(int newInterval) {
-        synchronized(listeners) {
-            if (newInterval == interval) {
-                return;
-            }
-
-            int oldInterval = interval;
-            super.setInterval(newInterval);
-
-            if (samplerTask != null) {
-                samplerTask.cancel();
-                SamplerTask oldSamplerTask = samplerTask;
-                samplerTask = new SamplerTask();
-                CountedTimerTaskUtils.reschedule(timer, oldSamplerTask,
-                                                 samplerTask, oldInterval,
-                                                 newInterval);
-            }
-            if (notifierTask != null) {
-                notifierTask.cancel();
-                NotifierTask oldNotifierTask = notifierTask;
-                notifierTask = new NotifierTask();
-                CountedTimerTaskUtils.reschedule(timer, oldNotifierTask,
-                                                 notifierTask, oldInterval,
-                                                 newInterval);
-            }
-        }
-    }
-
-    /**
-     * Fire MonitoredVmStructureChanged events.
-     *
-     * @param inserted List of Monitor objects inserted.
-     * @param removed List of Monitor objects removed.
-     */
-    @SuppressWarnings("unchecked") // Cast of result of clone
-    void fireMonitorStatusChangedEvents(List<Monitor> inserted, List<Monitor> removed) {
-        ArrayList<VmListener> registered = null;
-        MonitorStatusChangeEvent ev = null;
-
-        synchronized(listeners) {
-            registered = (ArrayList)listeners.clone();
-        }
-
-        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
-            VmListener l = i.next();
-            if (ev == null) {
-                ev = new MonitorStatusChangeEvent(this, inserted, removed);
-            }
-            l.monitorStatusChanged(ev);
-        }
-    }
-
-    /**
-     * Fire MonitoredVmStructureChanged events.
-     */
-    @SuppressWarnings("unchecked") // Cast of result of clone
-    void fireMonitorsUpdatedEvents() {
-        ArrayList<VmListener> registered = null;
-        VmEvent ev = null;
-
-        synchronized(listeners) {
-            registered = (ArrayList)listeners.clone();
-        }
-
-        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
-            VmListener l = i.next();
-            if (ev == null) {
-                ev = new VmEvent(this);
-            }
-            l.monitorsUpdated(ev);
-        }
-    }
-
-    /*
-     * Timer Tasks. There are two separate timer tasks here. The SamplerTask
-     * is active whenever we are attached to the remote JVM with a periodic
-     * sampling interval > 0. The NotifierTask is only active if a VmListener
-     * has registered with this RemoteMonitoredVm instance. Also, in the future
-     * we may want to run these tasks at different intervals. Currently,
-     * they run at the same interval and some significant work may
-     * need to be done to complete the separation of these two intervals.
-     */
-
-    /**
-     * Class to periodically check the state of the defined monitors
-     * for the remote MonitoredVm instance and to notify listeners of
-     * any detected changes.
-     */
-    private class NotifierTask extends CountedTimerTask {
-        public void run() {
-            super.run();
-            try {
-                MonitorStatus status = getMonitorStatus();
-
-                List<Monitor> inserted = status.getInserted();
-                List<Monitor> removed = status.getRemoved();
-
-                if (!inserted.isEmpty() || !removed.isEmpty()) {
-                    fireMonitorStatusChangedEvents(inserted, removed);
-                }
-            } catch (MonitorException e) {
-                // XXX: use logging api? fire disconnect events? mark errored?
-                // fireDisconnectedEvents();
-                System.err.println("Exception updating monitors for "
-                                   + getVmIdentifier());
-                e.printStackTrace();
-                // XXX: should we cancle the notifierTask here?
-                // this.cancel();
-            }
-        }
-    }
-
-    /**
-     * Class to periodically sample the remote instrumentation byte buffer
-     * and refresh the local copy. Registered listeners are notified of
-     * the completion of a sampling event.
-     */
-    private class SamplerTask extends CountedTimerTask {
-        public void run() {
-            super.run();
-            try {
-                sample();
-                fireMonitorsUpdatedEvents();
-
-            } catch (RemoteException e) {
-                // XXX: use logging api, mark vm as errored.
-                System.err.println("Exception taking sample for "
-                                   + getVmIdentifier());
-                e.printStackTrace();
-                this.cancel();
-            }
-        }
-    }
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteVmManager.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2004, 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.jvmstat.perfdata.monitor.protocol.rmi;
-
-import java.util.*;
-import java.util.regex.*;
-import java.io.*;
-import java.rmi.RemoteException;
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
-import sun.jvmstat.monitor.remote.*;
-
-/**
- * Class for managing the RemoteMonitoredVm instances on a remote system.
- * <p>
- * This class is responsible for the mechanism that detects the active
- * HotSpot Java Virtual Machines on the remote host and possibly for a
- * specific user. The ability to detect all possible HotSpot Java Virtual
- * Machines on the remote host may be limited by the permissions of the
- * principal running the RMI server application on the remote host.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteVmManager {
-
-    private RemoteHost remoteHost;
-    private String user;
-
-    /**
-     * Creates a RemoteVmManager instance for the remote system.
-     * <p>
-     * Manages RemoteMonitordVm instances for which the principal
-     * running the remote server has appropriate permissions.
-     *
-     * @param remoteHost the remote proxy object to the RMI server on
-     *                   the remote system.
-     */
-    public RemoteVmManager(RemoteHost remoteHost) {
-        this(remoteHost, null);
-    }
-
-    /**
-     * Creates a RemoteVmManager instance for the given user.
-     * <p>
-     * Manages RemoteMonitoredVm instances for all remote Java Virtual
-     * machines owned by the specified user on the remote system. The
-     * RMI server on the remote system must have the appropriate permissions
-     * to access the named users Java Virtual Machines.
-     *
-     * @param remoteHost the remote proxy object to the RMI server on
-     *                   the remote system.
-     * @param user the name of the user
-     */
-    public RemoteVmManager(RemoteHost remoteHost, String user) {
-        this.user = user;
-        this.remoteHost = remoteHost;
-    }
-
-    /**
-     * Return the current set of monitorable Java Virtual Machines.
-     * <p>
-     * The set returned by this method depends on the user name passed
-     * to the constructor. If no user name was specified, then this
-     * method will return all candidate JVMs on the system. Otherwise,
-     * only the JVMs for the given user will be returned. This assumes
-     * that the RMI server process has the appropriate permissions to
-     * access the target set of JVMs.
-     *
-     * @return Set - the Set of monitorable Java Virtual Machines
-     */
-    public Set<Integer> activeVms() throws MonitorException {
-        int[] active = null;
-
-        try {
-            active = remoteHost.activeVms();
-
-        } catch (RemoteException e) {
-            throw new MonitorException("Error communicating with remote host: "
-                                       + e.getMessage(), e);
-        }
-
-        Set<Integer> activeSet = new HashSet<Integer>(active.length);
-
-        for (int i = 0; i < active.length; i++) {
-            activeSet.add(active[i]);
-        }
-
-        return activeSet;
-    }
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/package.html	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-<!doctype html public "-//IETF//DTD HTML/EN">
-<html>
-<head>
-<!--
- 
-
- Copyright (c) 2004, 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.
-
--->
-</head>
-<body bgcolor="white">
-<p>
-Provides the implementation classes for the <em>rmi:</em> protocol for
-the HotSpot PerfData instrumentation buffer monitoring implementation.
-</p>
-<p>
-The <em>rmi:</em> protocol is the default protocol for the PerfData
-implementation when a hostname is specified as part of a HostIdentifier
-or VMIdentifier. It communicates with an RMI server on the remote machine
-that provides functions to get a list of available Java Virtual Machines
-and to acquire a copy of a Java Virtual Machine's instrumentation buffer.
-The RMI server may or may not use the PerfData implementation on the
-remote host to acquire this information. The <em>jstatd</em> server
-provides a PerfData implementation of the RMI server.
-</body>
-</html>
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/Jstatd.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2004, 2015, 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.tools.jstatd;
-
-import java.rmi.*;
-import java.rmi.server.*;
-import java.rmi.registry.Registry;
-import java.rmi.registry.LocateRegistry;
-import java.net.MalformedURLException;
-import sun.jvmstat.monitor.remote.*;
-
-/**
- * Application providing remote access to the jvmstat instrumentation
- * exported by local Java Virtual Machine processes. Remote access is
- * provided through an RMI interface.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class Jstatd {
-
-    private static Registry registry;
-    private static int port = -1;
-    private static boolean startRegistry = true;
-
-    private static void printUsage() {
-        System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]");
-    }
-
-    static void bind(String name, RemoteHostImpl remoteHost)
-                throws RemoteException, MalformedURLException, Exception {
-
-        try {
-            Naming.rebind(name, remoteHost);
-        } catch (java.rmi.ConnectException e) {
-            /*
-             * either the registry is not running or we cannot contact it.
-             * start an internal registry if requested.
-             */
-            if (startRegistry && registry == null) {
-                int localport = (port < 0) ? Registry.REGISTRY_PORT : port;
-                registry = LocateRegistry.createRegistry(localport);
-                bind(name, remoteHost);
-            } else {
-                throw e;
-            }
-        }
-    }
-
-    @SuppressWarnings("deprecation") // Use of RMISecurityManager
-    public static void main(String[] args) {
-        String rminame = null;
-        int argc = 0;
-
-        for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
-            String arg = args[argc];
-
-            if (arg.compareTo("-nr") == 0) {
-                startRegistry = false;
-            } else if (arg.startsWith("-p")) {
-                if (arg.compareTo("-p") != 0) {
-                    port = Integer.parseInt(arg.substring(2));
-                } else {
-                  argc++;
-                  if (argc >= args.length) {
-                      printUsage();
-                      System.exit(1);
-                  }
-                  port = Integer.parseInt(args[argc]);
-                }
-            } else if (arg.startsWith("-n")) {
-                if (arg.compareTo("-n") != 0) {
-                    rminame = arg.substring(2);
-                } else {
-                    argc++;
-                    if (argc >= args.length) {
-                        printUsage();
-                        System.exit(1);
-                    }
-                    rminame = args[argc];
-                }
-            } else {
-                printUsage();
-                System.exit(1);
-            }
-        }
-
-        if (argc < args.length) {
-            printUsage();
-            System.exit(1);
-        }
-
-        if (System.getSecurityManager() == null) {
-            System.setSecurityManager(new RMISecurityManager());
-        }
-
-        StringBuilder name = new StringBuilder();
-
-        if (port >= 0) {
-            name.append("//:").append(port);
-        }
-
-        if (rminame == null) {
-            rminame = "JStatRemoteHost";
-        }
-
-        name.append("/").append(rminame);
-
-        try {
-            // use 1.5.0 dynamically generated subs.
-            System.setProperty("java.rmi.server.ignoreSubClasses", "true");
-            RemoteHostImpl remoteHost = new RemoteHostImpl();
-            RemoteHost stub = (RemoteHost) UnicastRemoteObject.exportObject(
-                    remoteHost, 0);
-            bind(name.toString(), remoteHost);
-            System.out.println("jstatd started (bound to " + name.toString() + ")");
-            System.out.flush();
-        } catch (MalformedURLException e) {
-            if (rminame != null) {
-                System.out.println("Bad RMI server name: " + rminame);
-            } else {
-                System.out.println("Bad RMI URL: " + name);
-            }
-            e.printStackTrace(System.out);
-            System.exit(1);
-        } catch (java.rmi.ConnectException e) {
-            // could not attach to or create a registry
-            System.out.println("Could not contact RMI registry");
-            e.printStackTrace(System.out);
-            System.exit(1);
-        } catch (RemoteException e) {
-            System.out.println("Could not bind " + name + " to RMI Registry");
-            e.printStackTrace(System.out);
-            System.exit(1);
-        } catch (Exception e) {
-            System.out.println("Could not create remote object");
-            e.printStackTrace(System.out);
-            System.exit(1);
-        }
-    }
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/RemoteHostImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2004, 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.tools.jstatd;
-
-import java.util.*;
-import java.nio.*;
-import java.io.*;
-import java.net.*;
-import java.rmi.*;
-import java.rmi.server.*;
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
-import sun.jvmstat.monitor.remote.*;
-
-/**
- * Concrete implementation of the RemoteHost interface for the HotSpot
- * PerfData <em>rmi:</em> protocol.
- * <p>
- * This class provides remote access to the instrumentation exported
- * by HotSpot Java Virtual Machines through the PerfData shared memory
- * interface.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteHostImpl implements RemoteHost, HostListener {
-
-    private MonitoredHost monitoredHost;
-    private Set<Integer> activeVms;
-
-    public RemoteHostImpl() throws MonitorException {
-        try {
-            monitoredHost = MonitoredHost.getMonitoredHost("localhost");
-        } catch (URISyntaxException e) { }
-
-        activeVms = monitoredHost.activeVms();
-        monitoredHost.addHostListener(this);
-    }
-
-    public RemoteVm attachVm(int lvmid, String mode)
-                    throws RemoteException, MonitorException {
-        Integer v = lvmid;
-        RemoteVm stub = null;
-        StringBuilder sb = new StringBuilder();
-
-        sb.append("local://").append(lvmid).append("@localhost");
-        if (mode != null) {
-            sb.append("?mode=").append(mode);
-        }
-
-        String vmidStr = sb.toString();
-
-        try {
-            VmIdentifier vmid = new VmIdentifier(vmidStr);
-            MonitoredVm mvm = monitoredHost.getMonitoredVm(vmid);
-            RemoteVmImpl rvm = new RemoteVmImpl((BufferedMonitoredVm)mvm);
-            stub = (RemoteVm) UnicastRemoteObject.exportObject(rvm, 0);
-        }
-        catch (URISyntaxException e) {
-            throw new RuntimeException("Malformed VmIdentifier URI: "
-                                       + vmidStr, e);
-        }
-        return stub;
-    }
-
-    public void detachVm(RemoteVm rvm) throws RemoteException {
-        rvm.detach();
-    }
-
-    public int[] activeVms() throws MonitorException {
-        Object[] vms = null;
-        int[] vmids = null;
-
-        vms = monitoredHost.activeVms().toArray();
-        vmids = new int[vms.length];
-
-        for (int i = 0; i < vmids.length; i++) {
-            vmids[i] = ((Integer)vms[i]).intValue();
-        }
-        return vmids;
-    }
-
-    public void vmStatusChanged(VmStatusChangeEvent ev) {
-        synchronized(this.activeVms) {
-            activeVms.retainAll(ev.getActive());
-        }
-    }
-
-    public void disconnected(HostEvent ev) {
-        // we only monitor the local host, so this event shouldn't occur.
-    }
-}
--- a/jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/RemoteVmImpl.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2004, 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.tools.jstatd;
-
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.remote.*;
-
-/**
- * Concrete implementation of the RemoteVm interface for the HotSpot PerfData
- * shared memory implementation of the jvmstat monitoring APIs. This class
- * providing remote access to the instrumentation exported by a local HotSpot
- * Java Virtual Machine. The instrumentation buffer is shipped in whole to
- * the remote machine, which is responsible for parsing and provide access
- * to the contained data.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteVmImpl implements RemoteVm {
-
-    private BufferedMonitoredVm mvm;
-
-    RemoteVmImpl(BufferedMonitoredVm mvm) {
-        this.mvm = mvm;
-    }
-
-    public byte[] getBytes() {
-        return mvm.getBytes();
-    }
-
-    public int getCapacity() {
-        return mvm.getCapacity();
-    }
-
-    public void detach() {
-        mvm.detach();
-    }
-
-    public int getLocalVmId() {
-        return mvm.getVmIdentifier().getLocalVmId();
-    }
-}
--- a/jdk/src/jdk.jvmstat/share/classes/module-info.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/jdk.jvmstat/share/classes/module-info.java	Fri Apr 29 11:54:18 2016 -0700
@@ -28,12 +28,12 @@
         jdk.attach,
         jdk.jcmd,
         jdk.jconsole,
-        jdk.jvmstat.rmi;
+        jdk.jstatd;
     exports sun.jvmstat.monitor.event to
         jdk.jcmd,
-        jdk.jvmstat.rmi;
+        jdk.jstatd;
     exports sun.jvmstat.perfdata.monitor to
-        jdk.jvmstat.rmi;
+        jdk.jstatd;
 
     uses sun.jvmstat.monitor.MonitoredHostService;
     provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.file.MonitoredHostFileService;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.net;
+
+import java.io.FileDescriptor;
+import java.net.SocketException;
+import java.net.SocketOption;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.Set;
+import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.misc.SharedSecrets;
+
+/**
+ * Defines extended socket options, beyond those defined in
+ * {@link java.net.StandardSocketOptions}. These options may be platform
+ * specific.
+ *
+ * @since 1.8
+ */
+public final class ExtendedSocketOptions {
+
+    private static class ExtSocketOption<T> implements SocketOption<T> {
+        private final String name;
+        private final Class<T> type;
+        ExtSocketOption(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; }
+    }
+
+    private ExtendedSocketOptions() { }
+
+    /**
+     * Service level properties. When a security manager is installed,
+     * setting or getting this option requires a {@link NetworkPermission}
+     * {@code ("setOption.SO_FLOW_SLA")} or {@code "getOption.SO_FLOW_SLA"}
+     * respectively.
+     */
+    public static final SocketOption<SocketFlow> SO_FLOW_SLA = new
+        ExtSocketOption<SocketFlow>("SO_FLOW_SLA", SocketFlow.class);
+
+
+    private static final PlatformSocketOptions platformSocketOptions =
+            PlatformSocketOptions.get();
+
+    private static final boolean flowSupported =
+            platformSocketOptions.flowSupported();
+
+    private static final Set<SocketOption<?>> extendedOptions = options();
+
+    static Set<SocketOption<?>> options() {
+        if (flowSupported)
+            return Set.of(SO_FLOW_SLA);
+        else
+            return Collections.<SocketOption<?>>emptySet();
+    }
+
+    static {
+        // Registers the extended socket options with the base module.
+        sun.net.ext.ExtendedSocketOptions.register(
+                new sun.net.ext.ExtendedSocketOptions(extendedOptions) {
+
+            @Override
+            public void setOption(FileDescriptor fd,
+                                  SocketOption<?> option,
+                                  Object value)
+                throws SocketException
+            {
+                SecurityManager sm = System.getSecurityManager();
+                if (sm != null)
+                    sm.checkPermission(new NetworkPermission("setOption." + option.name()));
+
+                if (fd == null || !fd.valid())
+                    throw new SocketException("socket closed");
+
+                if (option == SO_FLOW_SLA) {
+                    assert flowSupported;
+                    SocketFlow flow = checkValueType(value, option.type());
+                    setFlowOption(fd, flow);
+                } else {
+                    throw new InternalError("Unexpected option " + option);
+                }
+            }
+
+            @Override
+            public Object getOption(FileDescriptor fd,
+                                    SocketOption<?> option)
+                throws SocketException
+            {
+                SecurityManager sm = System.getSecurityManager();
+                if (sm != null)
+                    sm.checkPermission(new NetworkPermission("getOption." + option.name()));
+
+                if (fd == null || !fd.valid())
+                    throw new SocketException("socket closed");
+
+                if (option == SO_FLOW_SLA) {
+                    assert flowSupported;
+                    SocketFlow flow = SocketFlow.create();
+                    getFlowOption(fd, flow);
+                    return flow;
+                } else {
+                    throw new InternalError("Unexpected option " + option);
+                }
+            }
+        });
+    }
+
+    @SuppressWarnings("unchecked")
+    private static <T> T checkValueType(Object value, Class<?> type) {
+        if (!type.isAssignableFrom(value.getClass())) {
+            String s = "Found: " + value.getClass() + ", Expected: " + type;
+            throw new IllegalArgumentException(s);
+        }
+        return (T) value;
+    }
+
+    private static final JavaIOFileDescriptorAccess fdAccess =
+            SharedSecrets.getJavaIOFileDescriptorAccess();
+
+    private static void setFlowOption(FileDescriptor fd, SocketFlow f)
+        throws SocketException
+    {
+        int status = platformSocketOptions.setFlowOption(fdAccess.get(fd),
+                                                         f.priority(),
+                                                         f.bandwidth());
+        f.status(status);  // augment the given flow with the status
+    }
+
+    private static void getFlowOption(FileDescriptor fd, SocketFlow f)
+        throws SocketException
+    {
+        int status = platformSocketOptions.getFlowOption(fdAccess.get(fd), f);
+        f.status(status);  // augment the given flow with the status
+    }
+
+    static class PlatformSocketOptions {
+
+        protected PlatformSocketOptions() {}
+
+        @SuppressWarnings("unchecked")
+        private static PlatformSocketOptions newInstance(String cn) {
+            Class<PlatformSocketOptions> c;
+            try {
+                c = (Class<PlatformSocketOptions>)Class.forName(cn);
+                return c.getConstructor(new Class<?>[] { }).newInstance();
+            } catch (ReflectiveOperationException x) {
+                throw new AssertionError(x);
+            }
+        }
+
+        private static PlatformSocketOptions create() {
+            String osname = AccessController.doPrivileged(
+                    new PrivilegedAction<String>() {
+                        public String run() {
+                            return System.getProperty("os.name");
+                        }
+                    });
+            if ("SunOS".equals(osname))
+                return newInstance("jdk.net.SolarisSocketOptions");
+            return new PlatformSocketOptions();
+        }
+
+        private static final PlatformSocketOptions instance = create();
+
+        static PlatformSocketOptions get() {
+            return instance;
+        }
+
+        int setFlowOption(int fd, int priority, long bandwidth)
+            throws SocketException
+        {
+            throw new UnsupportedOperationException("unsupported socket option");
+        }
+
+        int getFlowOption(int fd, SocketFlow f) throws SocketException {
+            throw new UnsupportedOperationException("unsupported socket option");
+        }
+
+        boolean flowSupported() {
+            return false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/share/classes/jdk/net/NetworkPermission.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.net;
+
+import java.security.BasicPermission;
+
+/**
+ * Represents permission to access the extended networking capabilities
+ * defined in the jdk.net package. These permissions contain a target
+ * name, but no actions list. Callers either possess the permission or not.
+ * <p>
+ * The following targets are defined:
+ *
+ * <table border=1 cellpadding=5 summary="permission target name,
+ *  what the target allows,and associated risks">
+ * <tr>
+ *   <th>Permission Target Name</th>
+ *   <th>What the Permission Allows</th>
+ *   <th>Risks of Allowing this Permission</th>
+ * </tr>
+ * <tr>
+ *   <td>setOption.SO_FLOW_SLA</td>
+ *   <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option
+ *       on any socket that supports it</td>
+ *   <td>allows caller to set a higher priority or bandwidth allocation
+ *       to sockets it creates, than they might otherwise be allowed.</td>
+ * </tr>
+ * <tr>
+ *   <td>getOption.SO_FLOW_SLA</td>
+ *   <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA}
+ *       setting from any socket that supports the option</td>
+ *   <td>allows caller access to SLA information that it might not
+ *       otherwise have</td>
+ * </tr></table>
+ *
+ * @see jdk.net.ExtendedSocketOptions
+ *
+ * @since 1.8
+ */
+
+public final class NetworkPermission extends BasicPermission {
+
+    private static final long serialVersionUID = -2012939586906722291L;
+
+    /**
+     * Creates a NetworkPermission with the given target name.
+     *
+     * @param name the permission target name
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
+     */
+    public NetworkPermission(String name)
+    {
+        super(name);
+    }
+
+    /**
+     * Creates a NetworkPermission with the given target name.
+     *
+     * @param name the permission target name
+     * @param actions should be {@code null}. Is ignored if not.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
+     */
+    public NetworkPermission(String name, String actions)
+    {
+        super(name, actions);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/share/classes/jdk/net/SocketFlow.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.net;
+
+import java.lang.annotation.Native;
+
+/**
+ * Represents the service level properties for the platform specific socket
+ * option {@link ExtendedSocketOptions#SO_FLOW_SLA}.
+ * <p>
+ * The priority and bandwidth parameters must be set before
+ * setting the socket option.
+ * <p>
+ * When the {@code SO_FLOW_SLA} option is set then it may not take effect
+ * immediately. If the value of the socket option is obtained with
+ * {@code getOption()} then the status may be returned as {@code INPROGRESS}
+ * until it takes effect. The priority and bandwidth values are only valid when
+ * the status is returned as OK.
+ * <p>
+ * When a security manager is installed, a {@link NetworkPermission}
+ * is required to set or get this option.
+ *
+ * @since 1.8
+ */
+public class SocketFlow {
+
+    @Native public static final int UNSET = -1;
+    @Native public static final int NORMAL_PRIORITY = 1;
+    @Native public static final int HIGH_PRIORITY = 2;
+
+    @Native private static final int NO_STATUS_VALUE = 0;
+    @Native private static final int OK_VALUE = 1;
+    @Native private static final int NO_PERMISSION_VALUE = 2;
+    @Native private static final int NOT_CONNECTED_VALUE = 3;
+    @Native private static final int NOT_SUPPORTED_VALUE = 4;
+    @Native private static final int ALREADY_CREATED_VALUE = 5;
+    @Native private static final int IN_PROGRESS_VALUE = 6;
+    @Native private static final int OTHER_VALUE = 7;
+
+    /**
+     * Enumeration of the return values from the SO_FLOW_SLA
+     * socket option. Both setting and getting the option return
+     * one of these statuses, which reflect the state of socket's
+     * flow.
+     *
+     * @since 1.8
+     */
+    public enum Status {
+        /**
+         * Set or get socket option has not been called yet. Status
+         * values can only be retrieved after calling set or get.
+         */
+        NO_STATUS(NO_STATUS_VALUE),
+        /**
+         * Flow successfully created.
+         */
+        OK(OK_VALUE),
+        /**
+         * Caller has no permission to create flow.
+         */
+        NO_PERMISSION(NO_PERMISSION_VALUE),
+        /**
+         * Flow can not be created because socket is not connected.
+         */
+        NOT_CONNECTED(NOT_CONNECTED_VALUE),
+        /**
+         * Flow creation not supported for this socket.
+         */
+        NOT_SUPPORTED(NOT_SUPPORTED_VALUE),
+        /**
+         * A flow already exists with identical attributes.
+         */
+        ALREADY_CREATED(ALREADY_CREATED_VALUE),
+        /**
+         * A flow is being created.
+         */
+        IN_PROGRESS(IN_PROGRESS_VALUE),
+        /**
+         * Some other unspecified error.
+         */
+        OTHER(OTHER_VALUE);
+
+        private final int value;
+        Status(int value) { this.value = value; }
+
+        static Status from(int value) {
+            if      (value == NO_STATUS.value)       return NO_STATUS;
+            else if (value == OK.value)              return OK;
+            else if (value == NO_PERMISSION.value)   return NO_PERMISSION;
+            else if (value == NOT_CONNECTED.value)   return NOT_CONNECTED;
+            else if (value == NOT_SUPPORTED.value)   return NOT_SUPPORTED;
+            else if (value == ALREADY_CREATED.value) return ALREADY_CREATED;
+            else if (value == IN_PROGRESS.value)     return IN_PROGRESS;
+            else if (value == OTHER.value)           return OTHER;
+            else     throw new InternalError("Unknown value: " + value);
+        }
+    }
+
+    private int priority = NORMAL_PRIORITY;
+    private long bandwidth = UNSET;
+    private Status status = Status.NO_STATUS;
+
+    /**
+     * Creates a new SocketFlow that can be used to set the SO_FLOW_SLA
+     * socket option and create a socket flow.
+     */
+    public static SocketFlow create() {
+        return new SocketFlow();
+    }
+
+    private SocketFlow() { }
+
+    /**
+     * Sets this SocketFlow's priority. Must be either NORMAL_PRIORITY
+     * HIGH_PRIORITY. If not set, a flow's priority is normal.
+     *
+     * @throws IllegalArgumentException if priority is not NORMAL_PRIORITY or
+     *         HIGH_PRIORITY.
+     */
+    public SocketFlow priority(int priority) {
+        if (priority != NORMAL_PRIORITY && priority != HIGH_PRIORITY)
+            throw new IllegalArgumentException("invalid priority :" + priority);
+        this.priority = priority;
+        return this;
+    }
+
+    /**
+     * Sets this SocketFlow's bandwidth. Must be greater than or equal to zero.
+     * A value of zero drops all packets for the socket.
+     *
+     * @throws IllegalArgumentException if bandwidth is less than zero.
+     */
+    public SocketFlow bandwidth(long bandwidth) {
+        if (bandwidth < 0)
+            throw new IllegalArgumentException("invalid bandwidth: " + bandwidth);
+        this.bandwidth = bandwidth;
+        return this;
+    }
+
+    /**
+     * Returns this SocketFlow's priority.
+     */
+    public int priority() {
+        return priority;
+    }
+
+    /**
+     * Returns this SocketFlow's bandwidth.
+     *
+     * @return this SocketFlow's bandwidth, or {@code -1} if status is not OK.
+     */
+    public long bandwidth() {
+        return bandwidth;
+    }
+
+    /**
+     * Returns the Status value of this SocketFlow. NO_STATUS is returned
+     * if the object was not used in a call to set or get the option.
+     */
+    public Status status() {
+        return status;
+    }
+
+    void status(int status) {
+        this.status = Status.from(status);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(super.toString());
+        sb.append(" [ priority=").append(priority())
+          .append(", bandwidth=").append(bandwidth())
+          .append(", status=").append(status())
+          .append(" ]");
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/share/classes/jdk/net/Sockets.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2016, 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 jdk.net;
+
+import java.net.*;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import jdk.net.ExtendedSocketOptions.PlatformSocketOptions;
+
+/**
+ * Defines static methods to set and get socket options defined by the
+ * {@link java.net.SocketOption} interface. All of the standard options defined
+ * by {@link java.net.Socket}, {@link java.net.ServerSocket}, and
+ * {@link java.net.DatagramSocket} can be set this way, as well as additional
+ * or platform specific options supported by each socket type.
+ * <p>
+ * The {@link #supportedOptions(Class)} method can be called to determine
+ * the complete set of options available (per socket type) on the
+ * current system.
+ * <p>
+ * When a security manager is installed, some non-standard socket options
+ * may require a security permission before being set or get.
+ * The details are specified in {@link ExtendedSocketOptions}. No permission
+ * is required for {@link java.net.StandardSocketOptions}.
+ *
+ * @see java.nio.channels.NetworkChannel
+ */
+public class Sockets {
+
+    private static final Map<Class<?>,Set<SocketOption<?>>>
+            options = optionSets();
+
+    private Sockets() {}
+
+    /**
+     * Sets the value of a socket option on a {@link java.net.Socket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     * @param value The value of the socket option. May be null for some
+     *              options.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IllegalArgumentException if the value is not valid for
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs, or socket is closed.
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> void setOption(Socket s, SocketOption<T> name, T value) throws IOException
+    {
+        s.setOption(name, value);
+    }
+
+    /**
+     * Returns the value of a socket option from a {@link java.net.Socket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     *
+     * @return The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> T getOption(Socket s, SocketOption<T> name) throws IOException
+    {
+        return s.getOption(name);
+    }
+
+    /**
+     * Sets the value of a socket option on a {@link java.net.ServerSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     * @param value The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IllegalArgumentException if the value is not valid for
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> void setOption(ServerSocket s, SocketOption<T> name, T value) throws IOException
+    {
+        s.setOption(name, value);
+    }
+
+    /**
+     * Returns the value of a socket option from a {@link java.net.ServerSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     *
+     * @return The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> T getOption(ServerSocket s, SocketOption<T> name) throws IOException
+    {
+        return s.getOption(name);
+    }
+
+    /**
+     * Sets the value of a socket option on a {@link java.net.DatagramSocket}
+     * or {@link java.net.MulticastSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     * @param value The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IllegalArgumentException if the value is not valid for
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> void setOption(DatagramSocket s, SocketOption<T> name, T value) throws IOException
+    {
+        s.setOption(name, value);
+    }
+
+    /**
+     * Returns the value of a socket option from a
+     * {@link java.net.DatagramSocket} or {@link java.net.MulticastSocket}
+     *
+     * @param s the socket
+     * @param name The socket option
+     *
+     * @return The value of the socket option.
+     *
+     * @throws UnsupportedOperationException if the socket does not support
+     *         the option.
+     *
+     * @throws IOException if an I/O error occurs
+     *
+     * @throws NullPointerException if name is null
+     *
+     * @throws SecurityException if a security manager is set and the
+     *         caller does not have any required permission.
+     *
+     * @see java.net.StandardSocketOptions
+     */
+    public static <T> T getOption(DatagramSocket s, SocketOption<T> name) throws IOException
+    {
+        return s.getOption(name);
+    }
+
+    /**
+     * Returns a set of {@link java.net.SocketOption}s supported by the
+     * given socket type. This set may include standard options and also
+     * non standard extended options.
+     *
+     * @param socketType the type of java.net socket
+     *
+     * @throws IllegalArgumentException if socketType is not a valid
+     *         socket type from the java.net package.
+     */
+    public static Set<SocketOption<?>> supportedOptions(Class<?> socketType) {
+        Set<SocketOption<?>> set = options.get(socketType);
+        if (set == null) {
+            throw new IllegalArgumentException("unknown socket type");
+        }
+        return set;
+    }
+
+    private static void checkValueType(Object value, Class<?> type) {
+        if (!type.isAssignableFrom(value.getClass())) {
+            String s = "Found: " + value.getClass().toString() + " Expected: "
+                        + type.toString();
+            throw new IllegalArgumentException(s);
+        }
+    }
+
+    private static volatile boolean checkedReusePort;
+    private static volatile boolean isReusePortAvailable;
+
+    /**
+     * Tells whether SO_REUSEPORT is supported.
+     */
+    static boolean isReusePortAvailable() {
+        if (!checkedReusePort) {
+            Set<SocketOption<?>> s = new Socket().supportedOptions();
+            isReusePortAvailable = s.contains(StandardSocketOptions.SO_REUSEPORT);
+            checkedReusePort = true;
+        }
+        return isReusePortAvailable;
+    }
+
+    private static Map<Class<?>,Set<SocketOption<?>>> optionSets() {
+        Map<Class<?>,Set<SocketOption<?>>> options = new HashMap<>();
+        boolean flowsupported = PlatformSocketOptions.get().flowSupported();
+        boolean reuseportsupported = isReusePortAvailable();
+        // Socket
+
+        Set<SocketOption<?>> set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_KEEPALIVE);
+        set.add(StandardSocketOptions.SO_SNDBUF);
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        if (reuseportsupported) {
+            set.add(StandardSocketOptions.SO_REUSEPORT);
+        }
+        set.add(StandardSocketOptions.SO_LINGER);
+        set.add(StandardSocketOptions.IP_TOS);
+        set.add(StandardSocketOptions.TCP_NODELAY);
+        if (flowsupported) {
+            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        }
+        set = Collections.unmodifiableSet(set);
+        options.put(Socket.class, set);
+
+        // ServerSocket
+
+        set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        if (reuseportsupported) {
+            set.add(StandardSocketOptions.SO_REUSEPORT);
+        }
+        set.add(StandardSocketOptions.IP_TOS);
+        set = Collections.unmodifiableSet(set);
+        options.put(ServerSocket.class, set);
+
+        // DatagramSocket
+
+        set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_SNDBUF);
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        if (reuseportsupported) {
+            set.add(StandardSocketOptions.SO_REUSEPORT);
+        }
+        set.add(StandardSocketOptions.IP_TOS);
+        if (flowsupported) {
+            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        }
+        set = Collections.unmodifiableSet(set);
+        options.put(DatagramSocket.class, set);
+
+        // MulticastSocket
+
+        set = new HashSet<>();
+        set.add(StandardSocketOptions.SO_SNDBUF);
+        set.add(StandardSocketOptions.SO_RCVBUF);
+        set.add(StandardSocketOptions.SO_REUSEADDR);
+        if (reuseportsupported) {
+            set.add(StandardSocketOptions.SO_REUSEPORT);
+        }
+        set.add(StandardSocketOptions.IP_TOS);
+        set.add(StandardSocketOptions.IP_MULTICAST_IF);
+        set.add(StandardSocketOptions.IP_MULTICAST_TTL);
+        set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
+        if (flowsupported) {
+            set.add(ExtendedSocketOptions.SO_FLOW_SLA);
+        }
+        set = Collections.unmodifiableSet(set);
+        options.put(MulticastSocket.class, set);
+
+        return Collections.unmodifiableMap(options);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/share/classes/jdk/net/package-info.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Platform specific socket options for the {@code java.net} and {@code java.nio.channels}
+ * socket classes.
+ *
+ * @since 1.8
+ */
+
+package jdk.net;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/share/classes/module-info.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+module jdk.net {
+    exports jdk.net;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/solaris/classes/jdk/net/SolarisSocketOptions.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2016, 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 jdk.net;
+
+import java.net.SocketException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import jdk.net.ExtendedSocketOptions.PlatformSocketOptions;
+
+class SolarisSocketOptions extends PlatformSocketOptions {
+
+    public SolarisSocketOptions() { }
+
+    @Override native int setFlowOption(int fd, int priority, long bandwidth)
+            throws SocketException;
+
+    @Override native int getFlowOption(int fd, SocketFlow f)
+            throws SocketException;
+
+    @Override native boolean flowSupported();
+
+    private static native void init();
+
+    static {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                System.loadLibrary("extnet");
+                return null;
+            }
+        });
+        init();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.c	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+#include "SolarisSocketOptions.h"
+
+static jfieldID sf_priority;
+static jfieldID sf_bandwidth;
+
+static int initialized = 0;
+
+/*
+ * Class:     jdk_net_SolarisSocketOptions
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_jdk_net_SolarisSocketOptions_init
+  (JNIEnv *env, jclass unused)
+{
+    if (!initialized) {
+        jclass c = (*env)->FindClass(env, "jdk/net/SocketFlow");
+        CHECK_NULL(c);
+        sf_priority = (*env)->GetFieldID(env, c, "priority", "I");
+        CHECK_NULL(sf_priority);
+        sf_bandwidth = (*env)->GetFieldID(env, c, "bandwidth", "J");
+        CHECK_NULL(sf_bandwidth);
+        initialized = 1;
+    }
+}
+
+/** Return the Status value. */
+static jint toStatus(int errval)
+{
+    switch (errval) {
+      case 0:           return jdk_net_SocketFlow_OK_VALUE;
+      case EPERM:       return jdk_net_SocketFlow_NO_PERMISSION_VALUE;
+      case ENOTCONN:    return jdk_net_SocketFlow_NOT_CONNECTED_VALUE;
+      case EOPNOTSUPP:  return jdk_net_SocketFlow_NOT_SUPPORTED_VALUE;
+      case EALREADY:    return jdk_net_SocketFlow_ALREADY_CREATED_VALUE;
+      case EINPROGRESS: return jdk_net_SocketFlow_IN_PROGRESS_VALUE;
+      default:          return jdk_net_SocketFlow_OTHER_VALUE;
+    }
+}
+
+void throwByNameWithLastError
+  (JNIEnv *env, const char *name, const char *defaultDetail)
+{
+  char defaultMsg[255];
+  sprintf(defaultMsg, "errno: %d, %s", errno, defaultDetail);
+  JNU_ThrowByNameWithLastError(env, name, defaultMsg);
+}
+
+/*
+ * Class:     jdk_net_SolarisSocketOptions
+ * Method:    setFlowOption0
+ * Signature: (IIJ)I
+ */
+JNIEXPORT jint JNICALL Java_jdk_net_SolarisSocketOptions_setFlowOption
+  (JNIEnv *env, jobject unused, jint fd, jint priority, jlong bandwidth)
+{
+    int rv;
+    sock_flow_props_t props;
+    memset(&props, 0, sizeof(props));
+    props.sfp_version = SOCK_FLOW_PROP_VERSION1;
+
+    if (priority != jdk_net_SocketFlow_UNSET) {
+        props.sfp_mask |= SFP_PRIORITY;
+        props.sfp_priority = priority;
+    }
+    if (bandwidth > jdk_net_SocketFlow_UNSET)  {
+        props.sfp_mask |= SFP_MAXBW;
+        props.sfp_maxbw = (uint64_t) bandwidth;
+    }
+
+    rv = setsockopt(fd, SOL_SOCKET, SO_FLOW_SLA, &props, sizeof(props));
+
+    if (rv < 0) {
+        if (errno == ENOPROTOOPT) {
+            JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
+                            "unsupported socket option");
+        } else if (errno == EACCES || errno == EPERM) {
+            JNU_ThrowByName(env, "java/net/SocketException", "Permission denied");
+        } else {
+            throwByNameWithLastError(env, "java/net/SocketException",
+                                     "set option SO_FLOW_SLA failed");
+        }
+        return 0;
+    }
+    return toStatus(props.sfp_status);
+}
+
+/*
+ * Class:     jdk_net_SolarisSocketOptions
+ * Method:    getFlowOption0
+ * Signature: (ILjdk/net/SocketFlow;)I
+ */
+JNIEXPORT jint JNICALL Java_jdk_net_SolarisSocketOptions_getFlowOption
+  (JNIEnv *env, jobject unused, jint fd, jobject flow)
+{
+    sock_flow_props_t props;
+    socklen_t sz = sizeof(props);
+
+    int rv = getsockopt(fd, SOL_SOCKET, SO_FLOW_SLA, &props, &sz);
+
+    if (rv < 0) {
+        if (errno == ENOPROTOOPT) {
+            JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
+                            "unsupported socket option");
+        } else if (errno == EACCES || errno == EPERM) {
+            JNU_ThrowByName(env, "java/net/SocketException", "Permission denied");
+        } else {
+            throwByNameWithLastError(env, "java/net/SocketException",
+                                     "get option SO_FLOW_SLA failed");
+        }
+        return -1;
+    }
+    /* first check status to see if flow exists */
+    if (props.sfp_status == 0) { /* OK */
+        /* can set the other fields now */
+        if (props.sfp_mask & SFP_PRIORITY) {
+            (*env)->SetIntField(env, flow, sf_priority, props.sfp_priority);
+        }
+        if (props.sfp_mask & SFP_MAXBW) {
+            (*env)->SetLongField(env, flow, sf_bandwidth,
+                                    (jlong)props.sfp_maxbw);
+        }
+    }
+    return toStatus(props.sfp_status);
+}
+
+JNIEXPORT jboolean JNICALL Java_jdk_net_SolarisSocketOptions_flowSupported
+  (JNIEnv *env, jobject unused)
+{
+    /* Do a simple dummy call, and try to figure out from that */
+    sock_flow_props_t props;
+    int rv, s;
+
+    s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+    if (s < 0) {
+        return JNI_FALSE;
+    }
+    memset(&props, 0, sizeof(props));
+    props.sfp_version = SOCK_FLOW_PROP_VERSION1;
+    props.sfp_mask |= SFP_PRIORITY;
+    props.sfp_priority = SFP_PRIO_NORMAL;
+    rv = setsockopt(s, SOL_SOCKET, SO_FLOW_SLA, &props, sizeof(props));
+    if (rv != 0 && errno == ENOPROTOOPT) {
+        rv = JNI_FALSE;
+    } else {
+        rv = JNI_TRUE;
+    }
+    close(s);
+    return rv;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.h	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+#ifndef SOLARIS_SOCKET_OPTIONS_H
+#define SOLARIS_SOCKET_OPTIONS_H
+
+#include <sys/socket.h>
+#include <jni.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include "jni_util.h"
+#include "jdk_net_SocketFlow.h"
+#include "SolarisSocketOptions.h"
+#include "jdk_net_SolarisSocketOptions.h"
+
+#ifndef SO_FLOW_SLA
+#define SO_FLOW_SLA 0x1018
+
+#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
+#pragma pack(4)
+#endif
+
+/*
+ * Used with the setsockopt(SO_FLOW_SLA, ...) call to set
+ * per socket service level properties.
+ * When the application uses per-socket API, we will enforce the properties
+ * on both outbound and inbound packets.
+ *
+ * For now, only priority and maxbw are supported in SOCK_FLOW_PROP_VERSION1.
+ */
+typedef struct sock_flow_props_s {
+        int             sfp_version;
+        uint32_t        sfp_mask;
+        int             sfp_priority;   /* flow priority */
+        uint64_t        sfp_maxbw;      /* bandwidth limit in bps */
+        int             sfp_status;     /* flow create status for getsockopt */
+} sock_flow_props_t;
+
+#define SOCK_FLOW_PROP_VERSION1 1
+
+/* bit mask values for sfp_mask */
+#define SFP_MAXBW       0x00000001      /* Flow Bandwidth Limit */
+#define SFP_PRIORITY    0x00000008      /* Flow priority */
+
+/* possible values for sfp_priority */
+#define SFP_PRIO_NORMAL 1
+#define SFP_PRIO_HIGH   2
+
+#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
+#pragma pack()
+#endif /* _LONG_LONG_ALIGNMENT */
+
+#endif /* SO_FLOW_SLA */
+
+#endif /* SOLARIS_SOCKET_OPTIONS_H */
--- a/jdk/src/jdk.policytool/share/classes/module-info.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/src/jdk.policytool/share/classes/module-info.java	Fri Apr 29 11:54:18 2016 -0700
@@ -28,6 +28,7 @@
     requires java.logging;
     requires java.management;
     requires java.sql;
+    requires jdk.net;
     requires java.security.jgss;
     requires jdk.security.jgss;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/String/concat/WithSecurityManager.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.Permission;
+
+/**
+ * @test
+ * @summary String concatenation fails with a custom SecurityManager that uses concatenation
+ * @bug 8155090
+ *
+ * @compile WithSecurityManager.java
+ *
+ * @run main/othervm -Xverify:all WithSecurityManager
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  WithSecurityManager
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            WithSecurityManager
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            WithSecurityManager
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      WithSecurityManager
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      WithSecurityManager
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  WithSecurityManager
+*/
+public class WithSecurityManager {
+    public static void main(String[] args) throws Throwable {
+        SecurityManager sm = new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                String abc = "abc";
+                String full = abc + "def";
+            }
+        };
+        System.setSecurityManager(sm);
+        ClassLoader cl = new ClassLoader() {};
+    }
+}
--- a/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -46,6 +46,8 @@
 import java.lang.System.Logger;
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
+import java.lang.reflect.Module;
+import java.security.AllPermission;
 
 /**
  * @test
@@ -70,6 +72,12 @@
             return  new AtomicBoolean(false);
         }
     };
+    static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
+        @Override
+        protected AtomicBoolean initialValue() {
+            return  new AtomicBoolean(false);
+        }
+    };
 
     public static class MyBundle extends ResourceBundle {
 
@@ -241,7 +249,7 @@
         }
 
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             // We should check the permission to obey the API contract, but
             // what happens if we don't?
             // This is the main difference compared with what we test in
@@ -251,8 +259,13 @@
                 sm.checkPermission(SimplePolicy.LOGGERFINDER_PERMISSION);
             }
 
-            PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
-            ClassLoader callerLoader = AccessController.doPrivileged(pa);
+            final boolean before = allowAll.get().getAndSet(true);
+            final ClassLoader callerLoader;
+            try {
+                callerLoader = caller.getClassLoader();
+            } finally {
+                allowAll.get().set(before);
+            }
             if (callerLoader == null) {
                 return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
             } else {
@@ -267,7 +280,7 @@
 
     static void setSecurityManager() {
         if (System.getSecurityManager() == null) {
-            Policy.setPolicy(new SimplePolicy(allowControl));
+            Policy.setPolicy(new SimplePolicy(allowControl, allowAll));
             System.setSecurityManager(new SecurityManager());
         }
     }
@@ -284,9 +297,9 @@
         BaseLoggerFinder provider =
                 BaseLoggerFinder.class.cast(LoggerFinder.getLoggerFinder());
         BaseLoggerFinder.LoggerImpl appSink =
-                BaseLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", CustomLoggerTest.class));
+                BaseLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", CustomLoggerTest.class.getModule()));
         BaseLoggerFinder.LoggerImpl sysSink =
-                BaseLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class));
+                BaseLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class.getModule()));
 
 
         Stream.of(args).map(TestCases::valueOf).forEach((testCase) -> {
@@ -695,34 +708,46 @@
         static final RuntimePermission LOGGERFINDER_PERMISSION =
                 new RuntimePermission("loggerFinder");
         final Permissions permissions;
+        final Permissions controlPermissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowControl;
-        public SimplePolicy(ThreadLocal<AtomicBoolean> allowControl) {
+        final ThreadLocal<AtomicBoolean> allowAll;
+        public SimplePolicy(ThreadLocal<AtomicBoolean> allowControl, ThreadLocal<AtomicBoolean> allowAll) {
             this.allowControl = allowControl;
+            this.allowAll = allowAll;
             permissions = new Permissions();
 
             // these are used for configuring the test itself...
+            controlPermissions = new Permissions();
+            controlPermissions.add(LOGGERFINDER_PERMISSION);
+
+            // these are used for simulating a doPrivileged call from
+            // a class in the BCL
             allPermissions = new Permissions();
-            allPermissions.add(LOGGERFINDER_PERMISSION);
+            allPermissions.add(new AllPermission());
+
+        }
+
+        Permissions permissions() {
+            if (allowAll.get().get()) return allPermissions;
+            if (allowControl.get().get()) return controlPermissions;
+            return permissions;
 
         }
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            if (allowControl.get().get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions().implies(permission);
         }
 
         @Override
         public PermissionCollection getPermissions(CodeSource codesource) {
-            return new PermissionsBuilder().addAll(allowControl.get().get()
-                    ? allPermissions : permissions).toPermissions();
+            return new PermissionsBuilder().addAll(permissions()).toPermissions();
         }
 
         @Override
         public PermissionCollection getPermissions(ProtectionDomain domain) {
-            return new PermissionsBuilder().addAll(allowControl.get().get()
-                    ? allPermissions : permissions).toPermissions();
+            return new PermissionsBuilder().addAll(permissions()).toPermissions();
         }
     }
 }
--- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java	Fri Apr 29 11:54:18 2016 -0700
@@ -25,13 +25,14 @@
 import java.security.PrivilegedAction;
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
+import java.lang.reflect.Module;
 
 public  class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
 
     static final RuntimePermission LOGGERFINDER_PERMISSION =
                 new RuntimePermission("loggerFinder");
     @Override
-    public Logger getLogger(String name, Class<?> caller) {
+    public Logger getLogger(String name, Module caller) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPermission(LOGGERFINDER_PERMISSION);
--- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -182,8 +182,8 @@
         TestLoggerFinder.LoggerImpl appLogger1 = null;
         try {
             appLogger1 =
-                TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerFinderTest.class));
-            loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", BaseLoggerFinderTest.class)");
+                TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerFinderTest.class.getModule()));
+            loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", BaseLoggerFinderTest.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a logger without permission");
             }
@@ -199,8 +199,8 @@
             allowControl.get().set(true);
             try {
                 appLogger1 =
-                    TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerFinderTest.class));
-                    loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", BaseLoggerFinderTest.class)");
+                    TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerFinderTest.class.getModule()));
+                    loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", BaseLoggerFinderTest.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
@@ -208,8 +208,8 @@
 
         TestLoggerFinder.LoggerImpl sysLogger1 = null;
         try {
-            sysLogger1 = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class));
-            loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class)");
+            sysLogger1 = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class.getModule()));
+            loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -224,8 +224,8 @@
             final boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                sysLogger1 = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class));
-                loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class)");
+                sysLogger1 = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class.getModule()));
+                loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
@@ -254,8 +254,8 @@
         //   callers and non system callers
         Logger appLogger2 = null;
         try {
-            appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, BaseLoggerFinderTest.class);
-            loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, BaseLoggerFinderTest.class)");
+            appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, BaseLoggerFinderTest.class.getModule());
+            loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, BaseLoggerFinderTest.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a logger without permission");
             }
@@ -270,8 +270,8 @@
             final boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, BaseLoggerFinderTest.class);
-                loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, BaseLoggerFinderTest.class)");
+                appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, BaseLoggerFinderTest.class.getModule());
+                loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, BaseLoggerFinderTest.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
@@ -279,8 +279,8 @@
 
         Logger sysLogger2 = null;
         try {
-            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class);
-            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class)");
+            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule());
+            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -295,8 +295,8 @@
             final boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class);
-                loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class))");
+                sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule());
+                loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule()))");
             } finally {
                 allowControl.get().set(old);
             }
--- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java	Fri Apr 29 11:54:18 2016 -0700
@@ -30,6 +30,7 @@
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Supplier;
 import java.lang.System.Logger;
+import java.lang.reflect.Module;
 
 /**
  * What our test provider needs to implement.
@@ -176,6 +177,6 @@
         }
     }
 
-    public Logger getLogger(String name, Class<?> caller);
-    public Logger getLocalizedLogger(String name, ResourceBundle bundle, Class<?> caller);
+    public Logger getLogger(String name, Module caller);
+    public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
 }
--- a/jdk/test/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -364,8 +364,8 @@
 
         Logger appLogger1 = null;
         try {
-            appLogger1 = provider.getLogger("foo", DefaultLoggerFinderTest.class);
-            loggerDescMap.put(appLogger1, "provider.getApplicationLogger(\"foo\")");
+            appLogger1 = provider.getLogger("foo", DefaultLoggerFinderTest.class.getModule());
+            loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", DefaultLoggerFinderTest.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a logger without permission");
             }
@@ -380,8 +380,8 @@
             boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                appLogger1 =provider.getLogger("foo", DefaultLoggerFinderTest.class);
-                loggerDescMap.put(appLogger1, "provider.getApplicationLogger(\"foo\")");
+                appLogger1 =provider.getLogger("foo", DefaultLoggerFinderTest.class.getModule());
+                loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", DefaultLoggerFinderTest.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
@@ -389,8 +389,8 @@
 
         Logger sysLogger1 = null;
         try {
-            sysLogger1 = provider.getLogger("foo", Thread.class);
-            loggerDescMap.put(sysLogger1, "provider.getSystemLogger(\"foo\")");
+            sysLogger1 = provider.getLogger("foo", Thread.class.getModule());
+            loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -405,8 +405,8 @@
             boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                sysLogger1 = provider.getLogger("foo", Thread.class);
-                loggerDescMap.put(sysLogger1, "provider.getSystemLogger(\"foo\")");
+                sysLogger1 = provider.getLogger("foo", Thread.class.getModule());
+                loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
@@ -417,8 +417,8 @@
 
         Logger appLogger2 = null;
         try {
-            appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, DefaultLoggerFinderTest.class);
-            loggerDescMap.put(appLogger2, "provider.getLocalizedApplicationLogger(\"foo\", loggerBundle)");
+            appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, DefaultLoggerFinderTest.class.getModule());
+            loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, DefaultLoggerFinderTest.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a logger without permission");
             }
@@ -433,8 +433,8 @@
             boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, DefaultLoggerFinderTest.class);
-                loggerDescMap.put(appLogger2, "provider.getLocalizedApplicationLogger(\"foo\", loggerBundle)");
+                appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, DefaultLoggerFinderTest.class.getModule());
+                loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, DefaultLoggerFinderTest.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
@@ -442,8 +442,8 @@
 
         Logger sysLogger2 = null;
         try {
-            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class);
-            loggerDescMap.put(sysLogger2, "provider.getLocalizedSystemLogger(\"foo\", loggerBundle)");
+            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule());
+            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -458,8 +458,8 @@
             boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class);
-                loggerDescMap.put(sysLogger2, "provider.getLocalizedSystemLogger(\"foo\", loggerBundle)");
+                sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule());
+                loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule())");
             } finally {
                 allowControl.get().set(old);
             }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -55,6 +55,7 @@
 import jdk.internal.logger.DefaultLoggerFinder;
 import jdk.internal.logger.SimpleConsoleLogger;
 import sun.util.logging.PlatformLogger;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -112,10 +113,10 @@
         public final static AtomicLong sequencer = new AtomicLong();
 
 
-        public Logger getLogger(String name, Class<?> caller);
-        public Logger getLocalizedLogger(String name, ResourceBundle bundle, Class<?> caller);
-        void setLevel(Logger logger, Level level, Class<?> caller);
-        void setLevel(Logger logger, PlatformLogger.Level level, Class<?> caller);
+        public Logger getLogger(String name, Module caller);
+        public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
+        void setLevel(Logger logger, Level level, Module caller);
+        void setLevel(Logger logger, PlatformLogger.Level level, Module caller);
         PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger);
     }
 
@@ -130,7 +131,7 @@
         }
 
         @Override
-        public void setLevel(Logger logger, Level level, Class<?> caller) {
+        public void setLevel(Logger logger, Level level, Module caller) {
             PrivilegedAction<Void> pa = () -> {
                 setLevel(logger, PlatformLogger.toPlatformLevel(level), caller);
                 return null;
@@ -139,7 +140,7 @@
         }
 
         @Override
-        public void setLevel(Logger logger, PlatformLogger.Level level, Class<?> caller) {
+        public void setLevel(Logger logger, PlatformLogger.Level level, Module caller) {
             PrivilegedAction<Logger> pa = () -> demandLoggerFor(logger.getName(), caller);
             Logger impl = AccessController.doPrivileged(pa);
             SimpleConsoleLogger.class.cast(impl)
@@ -606,11 +607,12 @@
             String name,
             ResourceBundle loggerBundle,
             Logger logger,
-            Class<?> caller) {
+            Class<?> callerClass) {
 
         System.out.println("Testing " + loggerDescMap.get(logger) + " [" + logger +"]");
         AtomicLong sequencer = TestLoggerFinder.sequencer;
 
+        Module caller = callerClass.getModule();
         Foo foo = new Foo();
         String fooMsg = foo.toString();
         for (Level loggerLevel : Level.values()) {
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -47,6 +47,7 @@
 import java.lang.System.Logger;
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -209,8 +210,6 @@
                 return Arrays.deepToString(toArray(false));
             }
 
-
-
             @Override
             public boolean equals(Object obj) {
                 return obj instanceof LogEvent
@@ -342,15 +341,15 @@
 
         }
 
-        public Logger getLogger(String name, Class<?> caller);
-        public Logger getLocalizedLogger(String name, ResourceBundle bundle, Class<?> caller);
+        public Logger getLogger(String name, Module caller);
+        public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
     }
 
     public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
         static final RuntimePermission LOGGERFINDER_PERMISSION =
                 new RuntimePermission("loggerFinder");
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(LOGGERFINDER_PERMISSION);
@@ -375,7 +374,7 @@
         }
     }
 
-    static Logger getLogger(String name, Class<?> caller) {
+    static Logger getLogger(String name, Module caller) {
         boolean old = allowAll.get().get();
         allowAccess.get().set(true);
         try {
@@ -465,7 +464,7 @@
 
         TestLoggerFinder.LoggerImpl appSink = null;
         try {
-            appSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerBridgeTest.class));
+            appSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerBridgeTest.class.getModule()));
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -480,7 +479,7 @@
             boolean old = allowControl.get().get();
             allowControl.get().set(true);
             try {
-                appSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerBridgeTest.class));
+                appSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerBridgeTest.class.getModule()));
             } finally {
                 allowControl.get().set(old);
             }
@@ -489,7 +488,7 @@
 
         TestLoggerFinder.LoggerImpl sysSink = null;
         try {
-            sysSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class));
+            sysSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class.getModule()));
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -527,13 +526,13 @@
 
         Logger sysLogger1 = null;
         try {
-            sysLogger1 = getLogger("foo", Thread.class);
+            sysLogger1 = getLogger("foo", Thread.class.getModule());
             loggerDescMap.put(sysLogger1,
-                    "jdk.internal.logger.LazyLoggers.getLogger(\"foo\", Thread.class)");
+                    "jdk.internal.logger.LazyLoggers.getLogger(\"foo\", Thread.class.getModule())");
 
             if (!hasRequiredPermissions) {
                 // check that the provider would have thrown an exception
-                provider.getLogger("foo", Thread.class);
+                provider.getLogger("foo", Thread.class.getModule());
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
         } catch (AccessControlException acx) {
@@ -572,8 +571,8 @@
 
         Logger sysLogger2 = null;
         try {
-            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class);
-            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class)");
+            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule());
+            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -47,6 +47,7 @@
 import java.security.AccessControlException;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -327,12 +328,12 @@
             }
         }
 
-        public Logger getLogger(String name, Class<?> caller);
+        public Logger getLogger(String name, Module caller);
     }
 
     public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(LOGGERFINDER_PERMISSION);
@@ -433,7 +434,7 @@
         try {
             allowControl.get().set(true);
             appSink = TestLoggerFinder.LoggerImpl.class.cast(
-                        provider.getLogger("foo", BasePlatformLoggerTest.class));
+                        provider.getLogger("foo", BasePlatformLoggerTest.class.getModule()));
         } finally {
             allowControl.get().set(before);
         }
@@ -442,7 +443,8 @@
         before = allowControl.get().get();
         try {
             allowControl.get().set(true);
-            sysSink = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class));
+            sysSink = TestLoggerFinder.LoggerImpl.class.cast(
+                        provider.getLogger("foo", Thread.class.getModule()));
         } finally {
             allowControl.get().set(before);
         }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -30,7 +30,7 @@
 import java.util.List;
 import java.util.ResourceBundle;
 import java.util.Set;
-
+import java.lang.reflect.Module;
 import jdk.internal.logger.BootstrapLogger;
 import jdk.internal.logger.LazyLoggers;
 
@@ -69,7 +69,7 @@
         }
 
         final Logger LOGGER =
-                LazyLoggers.getLogger("foo.bar", Thread.class);
+                LazyLoggers.getLogger("foo.bar", Thread.class.getModule());
         final sun.util.logging.PlatformLogger.Level PLATFORM_LEVEL =
                 sun.util.logging.PlatformLogger.Level.SEVERE;
         final MyResources BUNDLE = new MyResources();
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -43,6 +43,7 @@
 import java.util.stream.Stream;
 import jdk.internal.logger.BootstrapLogger;
 import jdk.internal.logger.LazyLoggers;
+import java.lang.reflect.Module;
 
 /*
  * @test
@@ -105,7 +106,7 @@
         if (BootstrapLogger.isBooted()) {
             throw new RuntimeException("VM should not be booted!");
         }
-        Logger logger = LazyLoggers.getLogger("foo.bar", Thread.class);
+        Logger logger = LazyLoggers.getLogger("foo.bar", Thread.class.getModule());
 
         if (test != TestCase.NO_SECURITY) {
             LogStream.err.println("Setting security manager");
@@ -261,7 +262,7 @@
         SimplePolicy.allowAll.set(Boolean.TRUE);
         try {
             bazbaz = java.lang.System.LoggerFinder
-                    .getLoggerFinder().getLogger("foo.bar.baz.baz", BootstrapLoggerTest.class);
+                    .getLoggerFinder().getLogger("foo.bar.baz.baz", BootstrapLoggerTest.class.getModule());
         } finally {
             SimplePolicy.allowAll.set(Boolean.FALSE);
         }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -51,6 +51,7 @@
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -164,6 +165,7 @@
                     null, null, level, bundle, key,
                     thrown, params);
         }
+
         public static LogEvent of(long sequenceNumber,
                 boolean isLoggable, String name,
                 sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
@@ -231,7 +233,7 @@
         try {
             // Preload classes before the security manager is on.
             providerClass = ClassLoader.getSystemClassLoader().loadClass("LoggerBridgeTest$LogProducerFinder");
-            ((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass);
+            ((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass.getModule());
         } catch (Exception ex) {
             throw new ExceptionInInitializerError(ex);
         }
@@ -415,7 +417,7 @@
         }
 
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(LOGGERFINDER_PERMISSION);
@@ -430,6 +432,15 @@
         }
     }
 
+    static ClassLoader getClassLoader(Module m) {
+        final boolean before = allowAll.get().getAndSet(true);
+        try {
+            return m.getClassLoader();
+        } finally {
+            allowAll.get().set(before);
+        }
+    }
+
     static final sun.util.logging.PlatformLogger.Level[] julLevels = {
         sun.util.logging.PlatformLogger.Level.ALL,
         sun.util.logging.PlatformLogger.Level.FINEST,
@@ -497,14 +508,14 @@
         try {
             Class<?> bridgeClass = Class.forName("jdk.internal.logger.LazyLoggers");
             lazyGetLogger = bridgeClass.getDeclaredMethod("getLogger",
-                    String.class, Class.class);
+                    String.class, Module.class);
             lazyGetLogger.setAccessible(true);
         } catch (Throwable ex) {
             throw new ExceptionInInitializerError(ex);
         }
     }
 
-    static Logger getLogger(LoggerFinder provider, String name, Class<?> caller) {
+    static Logger getLogger(LoggerFinder provider, String name, Module caller) {
         Logger logger;
         try {
             logger = Logger.class.cast(lazyGetLogger.invoke(null, name, caller));
@@ -522,14 +533,14 @@
         // The method above does not throw exception...
         // call the provider here to verify that an exception would have
         // been thrown by the provider.
-        if (logger != null && caller == Thread.class) {
+        if (logger != null && caller == Thread.class.getModule()) {
             Logger log = provider.getLogger(name, caller);
         }
         return logger;
     }
 
-    static Logger getLogger(LoggerFinder provider, String name, ResourceBundle bundle, Class<?> caller) {
-        if (caller.getClassLoader() != null) {
+    static Logger getLogger(LoggerFinder provider, String name, ResourceBundle bundle, Module caller) {
+        if (getClassLoader(caller) != null) {
             return System.getLogger(name,bundle);
         } else {
             return provider.getLocalizedLogger(name, bundle, caller);
@@ -614,12 +625,12 @@
 
 
         Logger appLogger1 = System.getLogger("foo");
-        loggerDescMap.put(appLogger1, "LogProducer.getApplicationLogger(\"foo\")");
+        loggerDescMap.put(appLogger1, "System.getLogger(\"foo\")");
 
         Logger sysLogger1 = null;
         try {
-            sysLogger1 = getLogger(provider, "foo", Thread.class);
-            loggerDescMap.put(sysLogger1, "LogProducer.getSystemLogger(\"foo\")");
+            sysLogger1 = getLogger(provider, "foo", Thread.class.getModule());
+            loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -636,12 +647,12 @@
 
         Logger appLogger2 =
                 System.getLogger("foo", loggerBundle);
-        loggerDescMap.put(appLogger2, "LogProducer.getApplicationLogger(\"foo\", loggerBundle)");
+        loggerDescMap.put(appLogger2, "System.getLogger(\"foo\", loggerBundle)");
 
         Logger sysLogger2 = null;
         try {
-            sysLogger2 = getLogger(provider, "foo", loggerBundle, Thread.class);
-            loggerDescMap.put(sysLogger2, "provider.getSystemLogger(\"foo\", loggerBundle)");
+            sysLogger2 = getLogger(provider, "foo", loggerBundle, Thread.class.getModule());
+            loggerDescMap.put(sysLogger2, "provider.getLogger(\"foo\", loggerBundle, Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -671,9 +682,9 @@
         allowControl.get().set(true);
         try {
            appSink = LogProducerFinder.LoggerImpl.class.cast(
-                   provider.getLogger("foo",  LoggerBridgeTest.class));
+                   provider.getLogger("foo",  LoggerBridgeTest.class.getModule()));
            sysSink = LogProducerFinder.LoggerImpl.class.cast(
-                        provider.getLogger("foo", Thread.class));
+                        provider.getLogger("foo", Thread.class.getModule()));
         } finally {
             allowControl.get().set(old);
         }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -53,6 +53,7 @@
 import java.util.ServiceLoader;
 import java.util.concurrent.atomic.AtomicReference;
 import jdk.internal.logger.SimpleConsoleLogger;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -166,8 +167,8 @@
 
         }
 
-        public Logger getLogger(String name, Class<?> caller);
-        public Logger getLocalizedLogger(String name, ResourceBundle bundle, Class<?> caller);
+        public Logger getLogger(String name, Module caller);
+        public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
     }
 
     public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
@@ -187,7 +188,7 @@
 
 
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(LOGGERFINDER_PERMISSION);
@@ -210,7 +211,7 @@
             throw new ServiceConfigurationError("Should not come here");
         }
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             throw new ServiceConfigurationError("Should not come here");
         }
     }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -49,6 +49,7 @@
 import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -94,7 +95,7 @@
         try {
             // Preload classes before the security manager is on.
             providerClass = ClassLoader.getSystemClassLoader().loadClass("PlatformLoggerBridgeTest$LogProducerFinder");
-            ((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass);
+            ((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass.getModule());
         } catch (Exception ex) {
             throw new ExceptionInInitializerError(ex);
         }
@@ -415,7 +416,7 @@
         }
 
         @Override
-        public Logger getLogger(String name, Class<?> caller) {
+        public Logger getLogger(String name, Module caller) {
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(LOGGERFINDER_PERMISSION);
@@ -598,7 +599,7 @@
         allowControl.get().set(true);
         try {
            sysSink = LogProducerFinder.LoggerImpl.class.cast(
-                        provider.getLogger("foo", Thread.class));
+                        provider.getLogger("foo", Thread.class.getModule()));
         } finally {
             allowControl.get().set(old);
         }
--- a/jdk/test/java/lang/System/LoggerFinder/internal/api/LoggerFinderAPITest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/api/LoggerFinderAPITest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -469,12 +469,12 @@
         errors.append(test.testGetLoggerOverriddenOnSpi());
         java.lang.System.Logger julLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLogger("foo", LoggerFinderAPITest.class);
+                        .getLogger("foo", LoggerFinderAPITest.class.getModule());
         errors.append(test.testDefaultJULLogger(julLogger));
         if (errors.length() > 0) throw new RuntimeException(errors.toString());
         java.lang.System.Logger julSystemLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLogger("bar", Thread.class);
+                        .getLogger("bar", Thread.class.getModule());
         errors.append(test.testDefaultJULLogger(julSystemLogger));
         if (errors.length() > 0) throw new RuntimeException(errors.toString());
         java.lang.System.Logger julLocalizedLogger =
@@ -482,7 +482,7 @@
                 System.getLogger("baz", bundleLocalized);
         java.lang.System.Logger julLocalizedSystemLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLocalizedLogger("oof", bundleLocalized, Thread.class);
+                        .getLocalizedLogger("oof", bundleLocalized, Thread.class.getModule());
         final String error = errors.toString();
         if (!error.isEmpty()) throw new RuntimeException(error);
         for (java.lang.System.Logger logger : new java.lang.System.Logger[] {
--- a/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -77,6 +77,7 @@
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
 import sun.util.logging.internal.LoggingProviderImpl;
+import java.lang.reflect.Module;
 
 /**
  * @author danielfuchs
@@ -1506,7 +1507,7 @@
         Logger getBackendLogger(String name) {
             if (isSystem) {
                 return LoggingProviderImpl.getLogManagerAccess().demandLoggerFor(
-                        LogManager.getLogManager(), name, Thread.class);
+                        LogManager.getLogManager(), name, Thread.class.getModule());
             } else {
                 return Logger.getLogger(name);
             }
@@ -1699,7 +1700,7 @@
                 Collections.synchronizedMap(new HashMap<>());
 
         @Override
-        public java.lang.System.Logger getLogger(String name, Class<?> caller) {
+        public java.lang.System.Logger getLogger(String name, Module caller) {
             ClassLoader callerLoader = caller.getClassLoader();
             if (callerLoader == null) {
                 systemLoggers.putIfAbsent(name, new CustomLogger(name));
@@ -1827,8 +1828,8 @@
             public void setLevel(java.lang.System.Logger logger, Level level) {
                 final CustomLoggerFinder.CustomLogger l =
                         (CustomLoggerFinder.CustomLogger)
-                        (isSystem ? provider.getLogger(logger.getName(), Thread.class) :
-                        provider.getLogger(logger.getName(), LoggerFinderBackendTest.class));
+                        (isSystem ? provider.getLogger(logger.getName(), Thread.class.getModule()) :
+                        provider.getLogger(logger.getName(), LoggerFinderBackendTest.class.getModule()));
                 l.setLevel(provider.fromJul(level));
             }
             @Override
@@ -1840,8 +1841,8 @@
             CustomLoggerFinder.CustomLevel getLevel(java.lang.System.Logger logger) {
                 final CustomLoggerFinder.CustomLogger l =
                         (CustomLoggerFinder.CustomLogger)
-                        (isSystem ? provider.getLogger(logger.getName(), Thread.class) :
-                        provider.getLogger(logger.getName(), LoggerFinderBackendTest.class));
+                        (isSystem ? provider.getLogger(logger.getName(), Thread.class.getModule()) :
+                        provider.getLogger(logger.getName(), LoggerFinderBackendTest.class.getModule()));
                 return l.level;
             }
 
@@ -1962,7 +1963,7 @@
         try {
             Class<?> lazyLoggers = jdk.internal.logger.LazyLoggers.class;
             getLazyLogger = lazyLoggers.getMethod("getLazyLogger",
-                    String.class, Class.class);
+                    String.class, Module.class);
             getLazyLogger.setAccessible(true);
             Class<?> loggerFinderLoader =
                     Class.forName("java.lang.System$LoggerFinder");
@@ -1973,7 +1974,7 @@
         }
     }
 
-    static java.lang.System.Logger getSystemLogger(String name, Class<?> caller) throws Exception {
+    static java.lang.System.Logger getSystemLogger(String name, Module caller) throws Exception {
         try {
             return java.lang.System.Logger.class.cast(getLazyLogger.invoke(null, name, caller));
         } catch (InvocationTargetException x) {
@@ -1986,7 +1987,7 @@
         }
     }
     static java.lang.System.Logger getSystemLogger(String name,
-            ResourceBundle bundle, Class<?> caller) throws Exception {
+            ResourceBundle bundle, Module caller) throws Exception {
         try {
             LoggerFinder provider = LoggerFinder.class.cast(accessLoggerFinder.invoke(null));
             return provider.getLocalizedLogger(name, bundle, caller);
@@ -2047,14 +2048,14 @@
         final BackendTester tester = factory.createBackendTester(false);
         final java.lang.System.Logger logger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLogger("foo", LoggerFinderBackendTest.class);
+                        .getLogger("foo", LoggerFinderBackendTest.class.getModule());
 
         testLogger(tester, logger, nb);
 
         // Test a simple system logger with JUL backend
         final java.lang.System.Logger system =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLogger("bar", Thread.class);
+                        .getLogger("bar", Thread.class.getModule());
         final BackendTester systemTester = factory.createBackendTester(true);
         testLogger(systemTester, system, nb);
 
@@ -2062,7 +2063,7 @@
         // JUL backend
         final java.lang.System.Logger noBundleLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLocalizedLogger("baz", null, LoggerFinderBackendTest.class);
+                        .getLocalizedLogger("baz", null, LoggerFinderBackendTest.class.getModule());
         final BackendTester noBundleTester =
                 factory.createBackendTester(false, spiLoggerClass);
         testLogger(noBundleTester, noBundleLogger, nb);
@@ -2071,7 +2072,7 @@
         // backend
         final java.lang.System.Logger noBundleSysLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLocalizedLogger("oof", null, Thread.class);
+                        .getLocalizedLogger("oof", null, Thread.class.getModule());
         final BackendTester noBundleSysTester =
                 factory.createBackendTester(true, spiLoggerClass);
         testLogger(noBundleSysTester, noBundleSysLogger, nb);
@@ -2085,14 +2086,14 @@
             System.out.println("System.Loggers.getLogger(\"baz\", null): got expected " + x);
         }
         final java.lang.System.Logger noBundleExtensionLogger =
-                getSystemLogger("baz", null, LoggerFinderBackendTest.class);
+                getSystemLogger("baz", null, LoggerFinderBackendTest.class.getModule());
         final BackendTester noBundleExtensionTester =
                 factory.createBackendTester(false, jdkLoggerClass);
         testLogger(noBundleExtensionTester, noBundleExtensionLogger, nb);
 
         // Test a simple system logger with JUL backend
         final java.lang.System.Logger sysExtensionLogger =
-                getSystemLogger("oof", Thread.class);
+                getSystemLogger("oof", Thread.class.getModule());
         final BackendTester sysExtensionTester =
                 factory.createBackendTester(true, jdkLoggerClass);
         testLogger(sysExtensionTester, sysExtensionLogger, nb);
@@ -2100,7 +2101,7 @@
         // Test a localized system logger with null resource bundle and JUL
         // backend
         final java.lang.System.Logger noBundleSysExtensionLogger =
-                getSystemLogger("oof", null, Thread.class);
+                getSystemLogger("oof", null, Thread.class.getModule());
         final BackendTester noBundleSysExtensionTester =
                 factory.createBackendTester(true, jdkLoggerClass);
         testLogger(noBundleSysExtensionTester, noBundleSysExtensionLogger, nb);
@@ -2127,7 +2128,7 @@
                 ResourceBundle.getBundle(ResourceBundeLocalized.class.getName());
         final java.lang.System.Logger bundleLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLocalizedLogger("toto", bundle, LoggerFinderBackendTest.class);
+                        .getLocalizedLogger("toto", bundle, LoggerFinderBackendTest.class.getModule());
         final BackendTester bundleTester =
                 factory.createBackendTester(false, spiLoggerClass, bundle);
         testLogger(bundleTester, bundleLogger, nb);
@@ -2135,7 +2136,7 @@
         // Test a localized system logger with resource bundle and JUL backend
         final java.lang.System.Logger bundleSysLogger =
                 java.lang.System.LoggerFinder.getLoggerFinder()
-                        .getLocalizedLogger("titi", bundle, Thread.class);
+                        .getLocalizedLogger("titi", bundle, Thread.class.getModule());
         final BackendTester bundleSysTester =
                 factory.createBackendTester(true, spiLoggerClass, bundle);
         testLogger(bundleSysTester, bundleSysLogger, nb);
@@ -2151,7 +2152,7 @@
         // Test a localized Jdk system logger with resource bundle and JUL
         // backend
         final java.lang.System.Logger bundleExtensionSysLogger =
-                getSystemLogger("titu", bundle, Thread.class);
+                getSystemLogger("titu", bundle, Thread.class.getModule());
         final BackendTester bundleExtensionSysTester =
                 factory.createBackendTester(true, jdkLoggerClass, bundle);
         testLogger(bundleExtensionSysTester, bundleExtensionSysLogger, nb);
--- a/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -48,6 +48,7 @@
 import java.lang.System.Logger;
 import java.util.stream.Stream;
 import sun.util.logging.internal.LoggingProviderImpl;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -246,7 +247,7 @@
         }
     }
 
-    static Logger getLogger(String name, Class<?> caller) {
+    static Logger getLogger(String name, Module caller) {
         boolean old = allowAccess.get().get();
         allowAccess.get().set(true);
         try {
@@ -311,8 +312,8 @@
                 ResourceBundle.getBundle(MyLoggerBundle.class.getName());
         final Map<Object, String> loggerDescMap = new HashMap<>();
 
-        Logger sysLogger1a = getLogger("foo", Thread.class);
-        loggerDescMap.put(sysLogger1a, "jdk.internal.logger.LazyLoggers.getLogger(\"foo\", Thread.class)");
+        Logger sysLogger1a = getLogger("foo", Thread.class.getModule());
+        loggerDescMap.put(sysLogger1a, "jdk.internal.logger.LazyLoggers.getLogger(\"foo\", Thread.class.getModule())");
 
         Logger appLogger1 = System.getLogger("foo");
         loggerDescMap.put(appLogger1, "System.getLogger(\"foo\")");
@@ -341,9 +342,9 @@
 
         Logger sysLogger1b = null;
         try {
-            sysLogger1b = provider.getLogger("foo", Thread.class);
+            sysLogger1b = provider.getLogger("foo", Thread.class.getModule());
             if (sysLogger1b != sysLogger1a) {
-                loggerDescMap.put(sysLogger1b, "provider.getLogger(\"foo\", Thread.class)");
+                loggerDescMap.put(sysLogger1b, "provider.getLogger(\"foo\", Thread.class.getModule())");
             }
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
@@ -367,8 +368,8 @@
 
         Logger sysLogger2 = null;
         try {
-            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class);
-            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class)");
+            sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule());
+            loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule())");
             if (!hasRequiredPermissions) {
                 throw new RuntimeException("Managed to obtain a system logger without permission");
             }
@@ -396,9 +397,9 @@
         allowAll.get().set(true);
         try {
             sysSink = LoggingProviderImpl.getLogManagerAccess().demandLoggerFor(
-                    LogManager.getLogManager(), "foo", Thread.class);
+                    LogManager.getLogManager(), "foo", Thread.class.getModule());
             appSink = LoggingProviderImpl.getLogManagerAccess().demandLoggerFor(
-                    LogManager.getLogManager(), "foo", DefaultLoggerBridgeTest.class);
+                    LogManager.getLogManager(), "foo", DefaultLoggerBridgeTest.class.getModule());
             if (appSink == sysSink) {
                 throw new RuntimeException("identical backend loggers");
             }
--- a/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -44,6 +44,7 @@
 import java.lang.System.LoggerFinder;
 import sun.util.logging.PlatformLogger;
 import sun.util.logging.internal.LoggingProviderImpl;
+import java.lang.reflect.Module;
 
 /**
  * @test
@@ -244,9 +245,9 @@
         LoggerFinder provider = LoggerFinder.getLoggerFinder();
         java.util.logging.Logger appSink = LoggingProviderImpl.getLogManagerAccess()
                 .demandLoggerFor(LogManager.getLogManager(), "foo",
-                        DefaultPlatformLoggerTest.class);
+                        DefaultPlatformLoggerTest.class.getModule());
         java.util.logging.Logger sysSink = LoggingProviderImpl.getLogManagerAccess()
-                .demandLoggerFor(LogManager.getLogManager(),"foo", Thread.class);
+                .demandLoggerFor(LogManager.getLogManager(),"foo", Thread.class.getModule());
         appSink.addHandler(new MyHandler());
         sysSink.addHandler(new MyHandler());
         appSink.setUseParentHandlers(VERBOSE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/ArrayConstructorTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+/* @test
+ * @bug 8155106
+ * @run testng/othervm -ea -esa test.java.lang.invoke.ArrayConstructorTest
+ */
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+
+import static java.lang.invoke.MethodType.methodType;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.*;
+
+
+public class ArrayConstructorTest {
+
+    static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+
+    @Test
+    public static void testFindConstructorArray() {
+        boolean caught = false;
+        try {
+            MethodHandle h = LOOKUP.findConstructor(Object[].class, methodType(void.class));
+        } catch (NoSuchMethodException nsme) {
+            assertEquals("no constructor for array class: [Ljava.lang.Object;", nsme.getMessage());
+            caught = true;
+        } catch (Exception e) {
+            throw new AssertionError("unexpected exception: " + e);
+        }
+        assertTrue(caught);
+    }
+
+    @DataProvider
+    static Object[][] arrayConstructorNegative() {
+        return new Object[][]{
+                {String.class, IllegalArgumentException.class, "not an array class: java.lang.String"},
+                {null, NullPointerException.class, null}
+        };
+    }
+
+    @Test(dataProvider = "arrayConstructorNegative")
+    public static void testArrayConstructorNegative(Class<?> clazz, Class<?> exceptionClass, String message) {
+        boolean caught = false;
+        try {
+            MethodHandle h = MethodHandles.arrayConstructor(clazz);
+        } catch (Exception e) {
+            assertEquals(exceptionClass, e.getClass());
+            if (message != null) {
+                assertEquals(message, e.getMessage());
+            }
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    @Test
+    public static void testArrayConstructor() throws Throwable {
+        MethodHandle h = MethodHandles.arrayConstructor(String[].class);
+        assertEquals(methodType(String[].class, int.class), h.type());
+        String[] a = (String[]) h.invoke(17);
+        assertEquals(17, a.length);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/JavaUtilConcurrentLookupTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016, 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
+ * @summary Tests that Lookup can be produced from classes under java.util.concurrent
+ * @bug 8154447
+ * @compile/module=java.base java/util/concurrent/LookupTester.java
+ * @run testng/othervm JavaUtilConcurrentLookupTest
+ */
+
+import org.testng.annotations.Test;
+
+import java.util.concurrent.LookupTester;
+
+public class JavaUtilConcurrentLookupTest {
+
+    @Test
+    public void testLookup() {
+        LookupTester.getLookup();
+    }
+
+    @Test
+    public void testLookupIn() {
+        LookupTester.getLookupIn();
+    }
+}
--- a/jdk/test/java/lang/invoke/PermuteArgsTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/PermuteArgsTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -23,6 +23,7 @@
 
 /* @test
  * @summary unit tests for method handles which permute their arguments
+ * @library /lib/testlibrary/jsr292 /lib/testlibrary
  * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
  */
 /* Examples of manual runs:
@@ -36,6 +37,8 @@
 import org.testng.*;
 import org.testng.annotations.*;
 
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
+
 import java.util.*;
 import java.lang.reflect.*;
 
@@ -122,9 +125,15 @@
         }
         new PermuteArgsTest().test();
     }
+
     static int testCases;
+
     @Test
     public void test() throws Throwable {
+        CodeCacheOverflowProcessor.runMHTest(this::test0);
+    }
+
+    public void test0() throws Throwable {
         testCases = 0;
         Lookup lookup = lookup();
         for (Method m : lookup.lookupClass().getDeclaredMethods()) {
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java	Fri Apr 29 11:54:18 2016 -0700
@@ -106,7 +106,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsChar
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsChar
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle(char[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle(char[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle(char[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle(char[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
@@ -93,7 +95,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsDouble
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsDouble
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle(double[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle(double[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle(double[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle(double[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
@@ -93,7 +95,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsFloat
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsFloat
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle(float[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle(float[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle(float[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle(float[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
@@ -93,7 +95,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsInt
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsInt
@@ -37,10 +38,10 @@
 import java.nio.ByteOrder;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
     static final int SIZE = Integer.BYTES;
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle(int[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle(int[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle(int[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle(int[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
@@ -93,7 +95,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsLong
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsLong
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle(long[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle(long[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle(long[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle(long[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
@@ -93,7 +95,6 @@
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAsShort
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAsShort
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle(short[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle(short[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle(short[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle(short[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
@@ -93,7 +95,6 @@
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
-        assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Fri Apr 29 11:54:18 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8154556
  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$
  * @run testng/othervm -Diters=20000                         VarHandleTestByteArrayAs$Type$
  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestByteArrayAs$Type$
@@ -57,15 +58,16 @@
         // Combinations of VarHandle byte[] or ByteBuffer
         vhss = new ArrayList<>();
         for (MemoryMode endianess : Arrays.asList(MemoryMode.BIG_ENDIAN, MemoryMode.LITTLE_ENDIAN)) {
+
+            ByteOrder bo = endianess == MemoryMode.BIG_ENDIAN
+                    ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
             VarHandleSource aeh = new VarHandleSource(
-                    MethodHandles.byteArrayViewVarHandle($type$[].class,
-                                                         endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteArrayViewVarHandle($type$[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(aeh);
 
             VarHandleSource bbh = new VarHandleSource(
-                    MethodHandles.byteBufferViewVarHandle($type$[].class,
-                                                          endianess == MemoryMode.BIG_ENDIAN),
+                    MethodHandles.byteBufferViewVarHandle($type$[].class, bo),
                     endianess, MemoryMode.READ_WRITE);
             vhss.add(bbh);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/java.base/java/util/concurrent/LookupTester.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+package java.util.concurrent;
+
+import java.lang.invoke.MethodHandles;
+
+public class LookupTester {
+    public static MethodHandles.Lookup getLookup() {
+        return MethodHandles.lookup();
+    }
+
+
+    public static MethodHandles.Lookup getLookupIn() {
+        return MethodHandles.lookup().in(ConcurrentHashMap.class);
+    }
+}
--- a/jdk/test/java/net/SocketOption/OptionsTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/net/SocketOption/OptionsTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,11 +23,13 @@
 
 /*
  * @test
- * @bug 8036979 8072384
+ * @bug 8036979 8072384 8044773
  * @run main/othervm -Xcheck:jni OptionsTest
  * @run main/othervm -Xcheck:jni -Djava.net.preferIPv4Stack=true OptionsTest
+ * @run main/othervm -Djdk.launcher.limitmods=java.base OptionsTest
  */
 
+import java.lang.reflect.Method;
 import java.net.*;
 import java.util.*;
 
@@ -43,7 +45,7 @@
         }
         Object option;
         Object testValue;
-    };
+    }
 
     // The tests set the option using the new API, read back the set value
     // which could be diferent, and then use the legacy get API to check
@@ -223,8 +225,7 @@
             } else if (option.equals(StandardSocketOptions.SO_REUSEPORT) && reuseport) {
                 return Boolean.valueOf(socket.getOption(StandardSocketOptions.SO_REUSEPORT));
             } else if (option.equals(StandardSocketOptions.IP_TOS)) {
-                return Integer.valueOf(jdk.net.Sockets.getOption(
-                    socket, StandardSocketOptions.IP_TOS));
+                return getServerSocketTrafficClass(socket);
             } else {
                 throw new RuntimeException("unexecpted socket option");
             }
@@ -281,4 +282,20 @@
         doDgSocketTests();
         doMcSocketTests();
     }
+
+    // Reflectively access jdk.net.Sockets.getOption so that the test can run
+    // without the jdk.net module.
+    static Object getServerSocketTrafficClass(ServerSocket ss) throws Exception {
+        try {
+            Class<?> c = Class.forName("jdk.net.Sockets");
+            Method m = c.getDeclaredMethod("getOption", ServerSocket.class, SocketOption.class);
+            return m.invoke(null, ss, StandardSocketOptions.IP_TOS);
+        } catch (ClassNotFoundException e) {
+            // Ok, jdk.net module not present, just fall back
+            System.out.println("jdk.net module not present, falling back.");
+            return Integer.valueOf(ss.getOption(StandardSocketOptions.IP_TOS));
+        } catch (ReflectiveOperationException e) {
+            throw new AssertionError(e);
+        }
+    }
 }
--- a/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,34 +21,48 @@
  * questions.
  */
 
-import jdk.net.ExtendedSocketOptions;
-
 import java.io.IOException;
+import java.lang.reflect.Field;
 import java.net.*;
+import java.util.ArrayList;
+import java.util.List;
 
 /*
  * @test
- * @bug 8143554
- * @run main UnsupportedOptionsTest
+ * @bug 8143554 8044773
  * @summary Test checks that UnsupportedOperationException for unsupported
  * SOCKET_OPTIONS is thrown by both getOption() and setOption() methods.
+ * @run main UnsupportedOptionsTest
+ * @run main/othervm -Djdk.launcher.limitmods=java.base UnsupportedOptionsTest
  */
+
 public class UnsupportedOptionsTest {
 
-    private static final SocketOption[] SOCKET_OPTIONS = {
-            StandardSocketOptions.IP_MULTICAST_IF,
-            StandardSocketOptions.IP_MULTICAST_LOOP,
-            StandardSocketOptions.IP_MULTICAST_TTL,
-            StandardSocketOptions.IP_TOS,
-            StandardSocketOptions.SO_BROADCAST,
-            StandardSocketOptions.SO_KEEPALIVE,
-            StandardSocketOptions.SO_LINGER,
-            StandardSocketOptions.SO_RCVBUF,
-            StandardSocketOptions.SO_REUSEADDR,
-            StandardSocketOptions.SO_SNDBUF,
-            StandardSocketOptions.TCP_NODELAY,
-            ExtendedSocketOptions.SO_FLOW_SLA
-    };
+    private static final List<SocketOption<?>> socketOptions = new ArrayList<>();
+
+    static {
+        socketOptions.add(StandardSocketOptions.IP_MULTICAST_IF);
+        socketOptions.add(StandardSocketOptions.IP_MULTICAST_LOOP);
+        socketOptions.add(StandardSocketOptions.IP_MULTICAST_TTL);
+        socketOptions.add(StandardSocketOptions.IP_TOS);
+        socketOptions.add(StandardSocketOptions.SO_BROADCAST);
+        socketOptions.add(StandardSocketOptions.SO_KEEPALIVE);
+        socketOptions.add(StandardSocketOptions.SO_LINGER);
+        socketOptions.add(StandardSocketOptions.SO_RCVBUF);
+        socketOptions.add(StandardSocketOptions.SO_REUSEADDR);
+        socketOptions.add(StandardSocketOptions.SO_SNDBUF);
+        socketOptions.add(StandardSocketOptions.TCP_NODELAY);
+
+        try {
+            Class<?> c = Class.forName("jdk.net.ExtendedSocketOptions");
+            Field field = c.getField("SO_FLOW_SLA");
+            socketOptions.add((SocketOption<?>)field.get(null));
+        } catch (ClassNotFoundException e) {
+            // ignore, jdk.net module not present
+        } catch (ReflectiveOperationException e) {
+            throw new AssertionError(e);
+        }
+    }
 
     public static void main(String[] args) throws IOException {
         Socket s = new Socket();
@@ -56,7 +70,7 @@
         DatagramSocket ds = new DatagramSocket();
         MulticastSocket ms = new MulticastSocket();
 
-        for (SocketOption option : SOCKET_OPTIONS) {
+        for (SocketOption option : socketOptions) {
             if (!s.supportedOptions().contains(option)) {
                 testUnsupportedSocketOption(s, option);
             }
--- a/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java	Fri Apr 29 11:54:18 2016 -0700
@@ -22,8 +22,10 @@
  */
 
 /* @test
- * @bug 4640544
+ * @bug 4640544 8044773
  * @summary Unit test for setOption/getOption/options methods
+ * @run main SocketOptionTests
+ * @run main/othervm -Djdk.launcher.limitmods=java.base SocketOptionTests
  */
 
 import java.nio.*;
--- a/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java	Fri Apr 29 11:54:18 2016 -0700
@@ -22,9 +22,11 @@
  */
 
 /* @test
- * @bug 4640544
+ * @bug 4640544 8044773
  * @summary Unit test for ServerSocketChannel setOption/getOption/options
  *          methods.
+ * @run main SocketOptionTests
+ * @run main/othervm -Djdk.launcher.limitmods=java.base SocketOptionTests
  */
 
 import java.nio.*;
--- a/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java	Fri Apr 29 11:54:18 2016 -0700
@@ -22,9 +22,11 @@
  */
 
 /* @test
- * @bug 4640544
+ * @bug 4640544 8044773
  * @summary Unit test to check SocketChannel setOption/getOption/options
  *          methods.
+ * @run main SocketOptionTests
+ * @run main/othervm -Djdk.launcher.limitmods=java.base SocketOptionTests
  */
 
 import java.nio.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/TEST.properties	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,1 @@
+modules = java.rmi
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java	Fri Apr 29 11:54:18 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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 @@
  * @summary The Serialization benchmark test. This java class is used to run the
  *          test under JTREG.
  * @library ../../
+ * @modules java.desktop
  * @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark
  * @build bench.Reporter bench.XmlReporter bench.ConfigFormatException
  * @build bench.Harness bench.TextReporter
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Arrays/AsList.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2016, 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 8155600
+ * @summary Tests for Arrays.asList()
+ * @run testng AsList
+ */
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.stream.IntStream;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
+
+public class AsList {
+    /*
+     * Iterator contract test
+     */
+    @Test(dataProvider = "Arrays")
+    public void testIterator(Object[] array) {
+        Iterator<Object> itr = Arrays.asList(array).iterator();
+        for (int i = 0; i < array.length; i++) {
+            assertTrue(itr.hasNext());
+            assertTrue(itr.hasNext()); // must be idempotent
+            assertSame(array[i], itr.next());
+            try {
+                itr.remove();
+                fail("Remove must throw");
+            } catch (UnsupportedOperationException ex) {
+                // expected
+            }
+        }
+        assertFalse(itr.hasNext());
+        for (int i = 0; i < 3; i++) {
+            assertFalse(itr.hasNext());
+            try {
+                itr.next();
+                fail("Next succeed when there's no data left");
+            } catch (NoSuchElementException ex) {
+                // expected
+            }
+        }
+    }
+
+    @DataProvider(name = "Arrays")
+    public static Object[][] arrays() {
+        Object[][] arrays = {
+            { new Object[] { } },
+            { new Object[] { 1 } },
+            { new Object[] { null } },
+            { new Object[] { null, 1 } },
+            { new Object[] { 1, null } },
+            { new Object[] { null, null } },
+            { new Object[] { null, 1, 2 } },
+            { new Object[] { 1, null, 2 } },
+            { new Object[] { 1, 2, null } },
+            { new Object[] { null, null, null } },
+            { new Object[] { 1, 2, 3, null, 4 } },
+            { new Object[] { "a", "a", "a", "a" } },
+            { IntStream.range(0, 100).boxed().toArray() }
+        };
+
+        return arrays;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/net/SocketFlow/SocketFlowBasic.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2016, 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 8765432
+ * @summary Basic test for SocketFlow API
+ * @run testng SocketFlowBasic
+ */
+
+import jdk.net.SocketFlow;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static jdk.net.SocketFlow.*;
+import static org.testng.Assert.*;
+
+public class SocketFlowBasic {
+
+    @DataProvider
+    public Object[][] validPriorities() {
+        return new Object[][] { {HIGH_PRIORITY}, {NORMAL_PRIORITY} };
+    }
+
+    @Test(dataProvider = "validPriorities")
+    public void priority(long validPriority) {
+        SocketFlow flow = SocketFlow.create();
+        flow.bandwidth(validPriority);
+        long bandwidth = flow.bandwidth();
+        assertTrue(bandwidth == validPriority, "Expected " + validPriority + ", got" + bandwidth);
+    }
+
+    @DataProvider
+    public Object[][] invalidPriorities() {
+        return new Object[][] { {HIGH_PRIORITY+10}, {NORMAL_PRIORITY-10000} };
+    }
+
+    @Test(dataProvider = "invalidPriorities", expectedExceptions = IllegalArgumentException.class)
+    public void priority(int invalidPriority) {
+        SocketFlow flow = SocketFlow.create();
+        flow.priority(invalidPriority);
+    }
+
+    @DataProvider
+    public Object[][] positiveBandwidth() {
+        return new Object[][] { {0}, {100}, {Integer.MAX_VALUE}, {Long.MAX_VALUE} };
+    }
+
+    @Test(dataProvider = "positiveBandwidth")
+    public void bandwidth(long posBandwidth) {
+        SocketFlow flow = SocketFlow.create();
+        flow.bandwidth(posBandwidth);
+        long bandwidth = flow.bandwidth();
+        assertTrue(bandwidth == posBandwidth, "Expected " + posBandwidth + ", got" + bandwidth);
+    }
+
+
+    @DataProvider
+    public Object[][] negativeBandwidth() {
+        return new Object[][] { {-1}, {-100}, {Integer.MIN_VALUE}, {Long.MIN_VALUE} };
+    }
+
+    @Test(dataProvider = "negativeBandwidth", expectedExceptions = IllegalArgumentException.class)
+    public void invalidBandwidth(long negBandwidth) {
+        SocketFlow flow = SocketFlow.create();
+        flow.bandwidth(negBandwidth);
+    }
+
+    @Test
+    public void status() {
+        SocketFlow flow = SocketFlow.create();
+        assertTrue(flow.status() == Status.NO_STATUS);
+    }
+}
--- a/jdk/test/jdk/net/Sockets/Test.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/jdk/net/Sockets/Test.java	Fri Apr 29 11:54:18 2016 -0700
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 8032808
- * @run main/othervm -Xcheck:jni Test
+ * @bug 8032808 8044773
+ * @modules jdk.net
+ * @run main/othervm -Xcheck:jni Test success
  * @run main/othervm/policy=policy.fail -Xcheck:jni Test fail
  * @run main/othervm/policy=policy.success -Xcheck:jni Test success
  */
@@ -35,15 +36,13 @@
 import java.util.concurrent.*;
 import java.util.Set;
 import jdk.net.*;
+import static java.lang.System.out;
 
 public class Test {
 
-    static boolean security;
-    static boolean success;
+    interface Runner { void run() throws Exception; }
 
-    interface Runner {
-        public void run() throws Exception;
-    }
+    static boolean expectSuccess;
 
     public static void main(String[] args) throws Exception {
 
@@ -52,95 +51,107 @@
 
         Sockets.supportedOptions(Socket.class);
 
-        security = System.getSecurityManager() != null;
-        success = security && args[0].equals("success");
+        expectSuccess = args[0].equals("success");
 
         // Main thing is to check for JNI problems
         // Doesn't matter if current system does not support the option
         // and currently setting the option with the loopback interface
         // doesn't work either
 
-        System.out.println ("Security Manager enabled: " + security);
-        if (security) {
-            System.out.println ("Success expected: " + success);
-        }
+        boolean sm = System.getSecurityManager() != null;
+        out.println("Security Manager enabled: " + sm);
+        out.println("Success expected: " + expectSuccess);
 
-        final SocketFlow flowIn = SocketFlow.create()
-            .bandwidth(1000)
-            .priority(SocketFlow.HIGH_PRIORITY);
+        SocketFlow flowIn = SocketFlow.create()
+                                      .bandwidth(1000)
+                                      .priority(SocketFlow.HIGH_PRIORITY);
 
-        ServerSocket ss = new ServerSocket(0);
-        int tcp_port = ss.getLocalPort();
-        final InetAddress loop = InetAddress.getByName("127.0.0.1");
-        final InetSocketAddress loopad = new InetSocketAddress(loop, tcp_port);
+        try (ServerSocket ss = new ServerSocket(0);
+             DatagramSocket dg = new DatagramSocket(0)) {
 
-        DatagramSocket dg = new DatagramSocket(0);
-        final int udp_port = dg.getLocalPort();
+            int tcp_port = ss.getLocalPort();
+            final InetAddress loop = InetAddress.getByName("127.0.0.1");
+            final InetSocketAddress loopad = new InetSocketAddress(loop, tcp_port);
+
+            final int udp_port = dg.getLocalPort();
 
-        // If option not available, end test
-        Set<SocketOption<?>> options = dg.supportedOptions();
-        if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) {
-            System.out.println("SO_FLOW_SLA not supported");
-            return;
-        }
+            // If option not available, end test
+            Set<SocketOption<?>> options = dg.supportedOptions();
+            if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) {
+                System.out.println("SO_FLOW_SLA not supported");
+                return;
+            }
 
-        final Socket s = new Socket("127.0.0.1", tcp_port);
-        final SocketChannel sc = SocketChannel.open();
-        sc.connect (new InetSocketAddress("127.0.0.1", tcp_port));
+            final Socket s = new Socket("127.0.0.1", tcp_port);
+            final SocketChannel sc = SocketChannel.open();
+            sc.connect(new InetSocketAddress("127.0.0.1", tcp_port));
 
-        doTest(()->{
-            Sockets.setOption(s, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
-        });
-        doTest(()->{
-            Sockets.getOption(s, ExtendedSocketOptions.SO_FLOW_SLA);
-        });
-        doTest(()->{
-            sc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
-        });
-        doTest(()->{
-            sc.getOption(ExtendedSocketOptions.SO_FLOW_SLA);
-        });
-        doTest(()->{
-            DatagramSocket dg1 = new DatagramSocket(0);
-            dg1.connect(loop, udp_port);
-            Sockets.setOption(dg1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
-        });
-        doTest(()->{
-            DatagramChannel dg2 = DatagramChannel.open();
-            dg2.bind(new InetSocketAddress(loop, 0));
-            dg2.connect(new InetSocketAddress(loop, udp_port));
-            dg2.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
-        });
-        doTest(()->{
-            MulticastSocket mc1 = new MulticastSocket(0);
-            mc1.connect(loop, udp_port);
-            Sockets.setOption(mc1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
-        });
-        doTest(()->{
-            AsynchronousSocketChannel asc = AsynchronousSocketChannel.open();
-            Future<Void> f = asc.connect(loopad);
-            f.get();
-            asc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
-        });
+            doTest("Sockets.setOption Socket", () -> {
+                out.println(flowIn);
+                Sockets.setOption(s, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                out.println(flowIn);
+            });
+            doTest("Sockets.getOption Socket",() -> {
+                Sockets.getOption(s, ExtendedSocketOptions.SO_FLOW_SLA);
+                out.println(flowIn);
+            });
+            doTest("Sockets.setOption SocketChannel",() ->
+                sc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn)
+            );
+            doTest("Sockets.getOption SocketChannel",() ->
+                sc.getOption(ExtendedSocketOptions.SO_FLOW_SLA)
+            );
+            doTest("Sockets.setOption DatagramSocket",() -> {
+                try (DatagramSocket dg1 = new DatagramSocket(0)) {
+                    dg1.connect(loop, udp_port);
+                    Sockets.setOption(dg1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                }
+            });
+            doTest("Sockets.setOption DatagramSocket 2", () -> {
+                try (DatagramChannel dg2 = DatagramChannel.open()) {
+                    dg2.bind(new InetSocketAddress(loop, 0));
+                    dg2.connect(new InetSocketAddress(loop, udp_port));
+                    dg2.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                }
+            });
+            doTest("Sockets.setOption MulticastSocket", () -> {
+                try (MulticastSocket mc1 = new MulticastSocket(0)) {
+                    mc1.connect(loop, udp_port);
+                    Sockets.setOption(mc1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                }
+            });
+            doTest("Sockets.setOption AsynchronousSocketChannel", () -> {
+                try (AsynchronousSocketChannel asc = AsynchronousSocketChannel.open()) {
+                    Future<Void> f = asc.connect(loopad);
+                    f.get();
+                    asc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                }
+            });
+        }
     }
 
-    static void doTest(Runner func) throws Exception {
+    static void doTest(String message, Runner func) throws Exception {
+        out.println(message);
         try {
             func.run();
-            if (security && !success) {
-                throw new RuntimeException("Test failed");
+            if (expectSuccess) {
+                out.println("Completed as expected");
+            } else {
+                throw new RuntimeException("Operation succeeded, but expected SecurityException");
             }
         } catch (SecurityException e) {
-            if (success) {
-                throw new RuntimeException("Test failed");
+            if (expectSuccess) {
+                throw new RuntimeException("Unexpected SecurityException", e);
+            } else {
+                out.println("Caught expected: " + e);
             }
         } catch (UnsupportedOperationException e) {
-            System.out.println (e);
+            System.out.println(e);
         } catch (IOException e) {
             // Probably a permission error, but we're not
             // going to check unless a specific permission exception
             // is defined.
-            System.out.println (e);
+            System.out.println(e);
         }
     }
 }
--- a/jdk/test/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,8 @@
  * questions.
  */
 
+import com.sun.swingset3.demos.button.ButtonDemo;
+import org.jtregext.GuiTestListener;
 import java.awt.Point;
 import java.awt.Robot;
 import java.awt.event.InputEvent;
@@ -32,6 +34,7 @@
 import static org.jemmy2ext.JemmyExt.*;
 import org.testng.annotations.Test;
 import static com.sun.swingset3.demos.button.ButtonDemo.*;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -41,31 +44,30 @@
  *          image is different from initial button image.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.button.ButtonDemo
  * @run testng ButtonDemoScreenshotTest
  */
+@Listeners(GuiTestListener.class)
 public class ButtonDemoScreenshotTest {
 
     private static final int BUTTON_COUNT = 6; // TODO: Decide about "open browser" buttons (value was 8 originally)
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            Robot rob = new Robot();
+        Robot rob = new Robot();
 
-            new ClassReference(com.sun.swingset3.demos.button.ButtonDemo.class.getCanonicalName()).startApplication();
+        new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
-            waitImageIsStill(rob, mainFrame);
+        JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
+        waitImageIsStill(rob, mainFrame);
 
-            // Check all the buttons
-            for (int i = 0; i < BUTTON_COUNT; i++) {
-                checkButton(mainFrame, i, rob);
-            }
-        });
+        // Check all the buttons
+        for (int i = 0; i < BUTTON_COUNT; i++) {
+            checkButton(mainFrame, i, rob);
+        }
     }
 
     public void checkButton(JFrameOperator jfo, int i, Robot rob) {
--- a/jdk/test/sanity/client/SwingSet/src/ButtonDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ButtonDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.JHyperlink;
 import com.sun.swingset3.demos.button.ButtonDemo;
 import java.util.concurrent.ArrayBlockingQueue;
@@ -38,7 +39,7 @@
 import static com.sun.swingset3.demos.button.ButtonDemo.*;
 import org.jemmy2ext.JemmyExt;
 import org.jemmy2ext.JemmyExt.MultiThreadedTryCatch;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -48,12 +49,13 @@
  *          on buttons before and after click.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.button.ButtonDemo
  * @run testng ButtonDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class ButtonDemoTest {
 
     private static final String[] BUTTON_TEXT_AFTER = {
@@ -92,34 +94,30 @@
     @Test
     public void test() throws Exception {
 
-        captureDebugInfoOnFail(() -> {
-
-            new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
+        new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
-            mainFrame.setComparator(EXACT_STRING_COMPARATOR);
-
-            // Check all the buttons
-            for (int i = 0; i < BUTTON_TOOLTIP.length; i++) {
-                String tooltip = BUTTON_TOOLTIP[i];
-
-                JButtonOperator button = new JButtonOperator(mainFrame, new ByToolTipChooser(tooltip));
+        JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
+        mainFrame.setComparator(EXACT_STRING_COMPARATOR);
 
-                assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
+        // Check all the buttons
+        for (int i = 0; i < BUTTON_TOOLTIP.length; i++) {
+            String tooltip = BUTTON_TOOLTIP[i];
+
+            JButtonOperator button = new JButtonOperator(mainFrame, new ByToolTipChooser(tooltip));
 
-                // Two buttons are hyperlinks, we don't want to click them
-                if (!button.getSource().getClass().equals(JHyperlink.class)) {
-                    checkButton(button);
-                }
+            assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
 
-                if (BUTTON_TEXT_AFTER.length > i) {
-                    assertEquals(BUTTON_TEXT_AFTER[i], button.getText());
-                } else {
-                    assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
-                }
+            // Two buttons are hyperlinks, we don't want to click them
+            if (!button.getSource().getClass().equals(JHyperlink.class)) {
+                checkButton(button);
             }
 
-        });
+            if (BUTTON_TEXT_AFTER.length > i) {
+                assertEquals(BUTTON_TEXT_AFTER[i], button.getText());
+            } else {
+                assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
+            }
+        }
     }
 
     private void checkButton(JButtonOperator button) throws Exception {
--- a/jdk/test/sanity/client/SwingSet/src/ComboBoxDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ComboBoxDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.combobox.ComboBoxDemo;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
@@ -28,7 +29,7 @@
 import org.netbeans.jemmy.operators.JComboBoxOperator;
 import org.netbeans.jemmy.operators.JFrameOperator;
 import static com.sun.swingset3.demos.combobox.ComboBoxDemo.*;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -37,12 +38,13 @@
  *          each value of each ComboBox.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.combobox.ComboBoxDemo
  * @run testng ComboBoxDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class ComboBoxDemoTest {
 
     private static enum ComboBoxInfo {
@@ -61,14 +63,13 @@
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication();
+
+        new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
-            for (ComboBoxInfo comboBoxInfo : ComboBoxInfo.values()) {
-                comboBoxChecker(frame, comboBoxInfo);
-            }
-        });
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        for (ComboBoxInfo comboBoxInfo : ComboBoxInfo.values()) {
+            comboBoxChecker(frame, comboBoxInfo);
+        }
     }
 
     private void comboBoxChecker(JFrameOperator jfo, ComboBoxInfo comboBoxInfo) {
--- a/jdk/test/sanity/client/SwingSet/src/ListDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ListDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.list.ListDemo;
 import static com.sun.swingset3.demos.list.ListDemo.DEMO_TITLE;
 import static org.testng.AssertJUnit.*;
@@ -30,7 +31,7 @@
 import org.netbeans.jemmy.operators.JCheckBoxOperator;
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JListOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -40,64 +41,64 @@
  *          list.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.list.ListDemo
  * @run testng ListDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class ListDemoTest {
 
     private static final int CHECKBOX_COUNT = 50;
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(ListDemo.class.getCanonicalName()).startApplication();
+
+        new ClassReference(ListDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        JListOperator listOp = new JListOperator(frame);
+
+        // Check *NO* Prefix and Suffixes Marked
+        for (int i = 0; i < CHECKBOX_COUNT; i++) {
+            JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
+            checkBox.changeSelection(false);
+        }
+        System.out.println("######## Number of Items = " + listOp.getModel().getSize());
+        assertEquals("Select None number of items is correct", 0, listOp.getModel().getSize());
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
-            JListOperator listOp = new JListOperator(frame);
+        // Check *ALL* Prefix and Suffixes Marked
+        for (int i = 0; i < CHECKBOX_COUNT; i++) {
+            JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
+            checkBox.changeSelection(true);
+        }
+        System.out.println("######## Number of Items = " + listOp.getModel().getSize());
+        assertEquals("Select All number of items is correct", CHECKBOX_COUNT / 2 * CHECKBOX_COUNT / 2, listOp.getModel().getSize());
 
-            // Check *NO* Prefix and Suffixes Marked
-            for (int i = 0; i < CHECKBOX_COUNT; i++) {
-                JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
+        // Check *ALL* Prefix and *NO* Suffixes Marked
+        for (int i = 0; i < CHECKBOX_COUNT; i++) {
+            JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
+            if (i < CHECKBOX_COUNT / 2) {
+                checkBox.changeSelection(true);
+            } else {
                 checkBox.changeSelection(false);
             }
-            System.out.println("######## Number of Items = " + listOp.getModel().getSize());
-            assertEquals("Select None number of items is correct", 0, listOp.getModel().getSize());
+        }
+        System.out.println("######## Number of Items = " + listOp.getModel().getSize());
+        assertEquals("Select All Prefixes and NO Suffixes number of items is correct", 0, listOp.getModel().getSize());
 
-            // Check *ALL* Prefix and Suffixes Marked
-            for (int i = 0; i < CHECKBOX_COUNT; i++) {
-                JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
+        // Check *NO* Prefix and *ALL* Suffixes Marked
+        for (int i = 0; i < CHECKBOX_COUNT; i++) {
+            JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
+            if (i < CHECKBOX_COUNT / 2) {
+                checkBox.changeSelection(false);
+            } else {
                 checkBox.changeSelection(true);
             }
-            System.out.println("######## Number of Items = " + listOp.getModel().getSize());
-            assertEquals("Select All number of items is correct", CHECKBOX_COUNT / 2 * CHECKBOX_COUNT / 2, listOp.getModel().getSize());
-
-            // Check *ALL* Prefix and *NO* Suffixes Marked
-            for (int i = 0; i < CHECKBOX_COUNT; i++) {
-                JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
-                if (i < CHECKBOX_COUNT / 2) {
-                    checkBox.changeSelection(true);
-                } else {
-                    checkBox.changeSelection(false);
-                }
-            }
-            System.out.println("######## Number of Items = " + listOp.getModel().getSize());
-            assertEquals("Select All Prefixes and NO Suffixes number of items is correct", 0, listOp.getModel().getSize());
-
-            // Check *NO* Prefix and *ALL* Suffixes Marked
-            for (int i = 0; i < CHECKBOX_COUNT; i++) {
-                JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
-                if (i < CHECKBOX_COUNT / 2) {
-                    checkBox.changeSelection(false);
-                } else {
-                    checkBox.changeSelection(true);
-                }
-            }
-            System.out.println("######## Number of Items = " + listOp.getModel().getSize());
-            assertEquals("Select NO Prefixes and All Suffixes number of items is correct", 0, listOp.getModel().getSize());
-        });
+        }
+        System.out.println("######## Number of Items = " + listOp.getModel().getSize());
+        assertEquals("Select NO Prefixes and All Suffixes number of items is correct", 0, listOp.getModel().getSize());
     }
 
     private JCheckBoxOperator getJCheckBoxOperator(JFrameOperator frame, int index) {
--- a/jdk/test/sanity/client/SwingSet/src/OptionPaneDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/OptionPaneDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,10 +21,10 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.optionpane.OptionPaneDemo;
 import static com.sun.swingset3.demos.optionpane.OptionPaneDemo.*;
 import javax.swing.UIManager;
-import static org.jemmy2ext.JemmyExt.*;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 import org.netbeans.jemmy.ClassReference;
@@ -34,6 +34,7 @@
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JLabelOperator;
 import org.netbeans.jemmy.operators.JTextFieldOperator;
+import org.testng.annotations.Listeners;
 
 
 /*
@@ -43,12 +44,13 @@
  *          and choosing different options in them.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.optionpane.OptionPaneDemo
  * @run testng OptionPaneDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class OptionPaneDemoTest {
 
     public static final String SOME_TEXT_TO_TYPE = "I am some text";
@@ -59,21 +61,20 @@
     public static final String TEXT_TO_TYPE = "Hooray! I'm a textField";
     public static final String NO = "No";
     public static final String YES = "Yes";
-    public static final String SELECT_AN__OPTION = UIManager.getString("OptionPane.titleText");
+    public static final String SELECT_AN_OPTION = UIManager.getString("OptionPane.titleText");
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
 
-            showInputDialog(frame);
-            showWarningDialog(frame);
-            showMessageDialog(frame);
-            showComponentDialog(frame);
-            showConfirmationDialog(frame);
-        });
+        showInputDialog(frame);
+        showWarningDialog(frame);
+        showMessageDialog(frame);
+        showComponentDialog(frame);
+        showConfirmationDialog(frame);
     }
 
     public void showInputDialog(JFrameOperator jfo) throws Exception {
@@ -286,7 +287,7 @@
         {
             new JButtonOperator(jfo, CONFIRM_BUTTON).pushNoBlock();
 
-            JDialogOperator jdo = new JDialogOperator(SELECT_AN__OPTION);
+            JDialogOperator jdo = new JDialogOperator(SELECT_AN_OPTION);
             new JButtonOperator(jdo, YES).pushNoBlock();
 
             JDialogOperator jdo1 = new JDialogOperator(MESSAGE);
@@ -306,7 +307,7 @@
         {
             new JButtonOperator(jfo, CONFIRM_BUTTON).pushNoBlock();
 
-            JDialogOperator jdo = new JDialogOperator(SELECT_AN__OPTION);
+            JDialogOperator jdo = new JDialogOperator(SELECT_AN_OPTION);
             new JButtonOperator(jdo, NO).pushNoBlock();
 
             JDialogOperator jdo1 = new JDialogOperator(MESSAGE);
@@ -326,7 +327,7 @@
         {
             new JButtonOperator(jfo, CONFIRM_BUTTON).pushNoBlock();
 
-            JDialogOperator jdo = new JDialogOperator(SELECT_AN__OPTION);
+            JDialogOperator jdo = new JDialogOperator(SELECT_AN_OPTION);
 
             assertTrue("Show Confirmation Dialog Cancel Option", jdo.isShowing());
 
--- a/jdk/test/sanity/client/SwingSet/src/ProgressBarDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ProgressBarDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.progressbar.ProgressBarDemo;
 import static com.sun.swingset3.demos.progressbar.ProgressBarDemo.*;
 import java.awt.Component;
@@ -31,7 +32,7 @@
 import org.netbeans.jemmy.operators.JButtonOperator;
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JProgressBarOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -40,31 +41,31 @@
  *          buttons and checking the progress bar and the buttons state.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.progressbar.ProgressBarDemo
  * @run testng ProgressBarDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class ProgressBarDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
 
-            JButtonOperator startButton = new JButtonOperator(frame, START_BUTTON);
-            JButtonOperator stopButton = new JButtonOperator(frame, STOP_BUTTON);
-            JProgressBarOperator jpbo = new JProgressBarOperator(frame);
+        JButtonOperator startButton = new JButtonOperator(frame, START_BUTTON);
+        JButtonOperator stopButton = new JButtonOperator(frame, STOP_BUTTON);
+        JProgressBarOperator jpbo = new JProgressBarOperator(frame);
 
-            // Check that progress completes and corect enable/disable of start/stop buttons
-            checkCompleteProgress(frame, startButton, stopButton, jpbo);
+        // Check that progress completes and corect enable/disable of start/stop buttons
+        checkCompleteProgress(frame, startButton, stopButton, jpbo);
 
-            // Check progess bar progression and start/stop button disabled/enabled states
-            checkStartStop(frame, startButton, stopButton, jpbo);
-        });
+        // Check progess bar progression and start/stop button disabled/enabled states
+        checkStartStop(frame, startButton, stopButton, jpbo);
     }
 
     // Check that progress completes and corect enable/disable of start/stop buttons
--- a/jdk/test/sanity/client/SwingSet/src/ScrollPaneDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ScrollPaneDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.scrollpane.ScrollPaneDemo;
 import static com.sun.swingset3.demos.scrollpane.ScrollPaneDemo.DEMO_TITLE;
 import static org.testng.AssertJUnit.*;
@@ -28,7 +29,7 @@
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JScrollPaneOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -37,73 +38,73 @@
  *          to left and to right and checking scroll bar values.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.scrollpane.ScrollPaneDemo
  * @run testng ScrollPaneDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class ScrollPaneDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(ScrollPaneDemo.class.getName()).startApplication();
+
+        new ClassReference(ScrollPaneDemo.class.getName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
-            JScrollPaneOperator jspo = new JScrollPaneOperator(frame);
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        JScrollPaneOperator jspo = new JScrollPaneOperator(frame);
 
-            // Set initial scrollbar positions
-            int initialVerticalValue = jspo.getVerticalScrollBar().getValue();
-            int initialHorizontalValue = jspo.getHorizontalScrollBar().getValue();
+        // Set initial scrollbar positions
+        int initialVerticalValue = jspo.getVerticalScrollBar().getValue();
+        int initialHorizontalValue = jspo.getHorizontalScrollBar().getValue();
 
-            System.out.println("Initial Vertical Value = " + jspo.getVerticalScrollBar().getValue());
-            System.out.println("Initial HoriZontal Value = " + jspo.getHorizontalScrollBar().getValue());
+        System.out.println("Initial Vertical Value = " + jspo.getVerticalScrollBar().getValue());
+        System.out.println("Initial HoriZontal Value = " + jspo.getHorizontalScrollBar().getValue());
 
-            // Check scroll to Bottom
-            {
-                jspo.scrollToBottom();
-                int currentValue = jspo.getVerticalScrollBar().getValue();
-                System.out.println("Final Value = " + currentValue);
-                assertTrue("Scroll to Bottom of Pane "
-                        + "(initialVerticalValue, actual value: " + initialVerticalValue + " "
-                        + "< currentValue, actual value = " + currentValue + ")",
-                        initialVerticalValue < currentValue);
-            }
+        // Check scroll to Bottom
+        {
+            jspo.scrollToBottom();
+            int currentValue = jspo.getVerticalScrollBar().getValue();
+            System.out.println("Final Value = " + currentValue);
+            assertTrue("Scroll to Bottom of Pane "
+                    + "(initialVerticalValue, actual value: " + initialVerticalValue + " "
+                    + "< currentValue, actual value = " + currentValue + ")",
+                    initialVerticalValue < currentValue);
+        }
 
-            // Check scroll to Top
-            {
-                jspo.scrollToTop();
-                int currentValue = jspo.getVerticalScrollBar().getValue();
-                System.out.println("Top Scroll Final Value = " + currentValue);
-                assertTrue("Scroll to Top of Pane "
-                        + "(initialVerticalValue, actual value: " + initialVerticalValue + " "
-                        + "> currentValue, actual value = " + currentValue + ")",
-                        initialVerticalValue > currentValue);
-            }
+        // Check scroll to Top
+        {
+            jspo.scrollToTop();
+            int currentValue = jspo.getVerticalScrollBar().getValue();
+            System.out.println("Top Scroll Final Value = " + currentValue);
+            assertTrue("Scroll to Top of Pane "
+                    + "(initialVerticalValue, actual value: " + initialVerticalValue + " "
+                    + "> currentValue, actual value = " + currentValue + ")",
+                    initialVerticalValue > currentValue);
+        }
 
-            // Check scroll to Left
-            {
-                jspo.scrollToLeft();
-                int currentValue = jspo.getHorizontalScrollBar().getValue();
-                System.out.println("Scroll to Left Final Value = " + currentValue);
-                assertTrue("Scroll to Left of Pane "
-                        + "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
-                        + "> currentValue, actual value = " + currentValue + ")",
-                        initialHorizontalValue > currentValue);
-            }
+        // Check scroll to Left
+        {
+            jspo.scrollToLeft();
+            int currentValue = jspo.getHorizontalScrollBar().getValue();
+            System.out.println("Scroll to Left Final Value = " + currentValue);
+            assertTrue("Scroll to Left of Pane "
+                    + "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
+                    + "> currentValue, actual value = " + currentValue + ")",
+                    initialHorizontalValue > currentValue);
+        }
 
-            // Check scroll to Right
-            {
-                jspo.scrollToRight();
-                int currentValue = jspo.getHorizontalScrollBar().getValue();
-                System.out.println("Scroll to Right Final Value = " + currentValue);
-                assertTrue("Scroll to Right of Pane "
-                        + "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
-                        + "< currentValue, actual value = " + currentValue + ")",
-                        initialHorizontalValue < currentValue);
-            }
-        });
+        // Check scroll to Right
+        {
+            jspo.scrollToRight();
+            int currentValue = jspo.getHorizontalScrollBar().getValue();
+            System.out.println("Scroll to Right Final Value = " + currentValue);
+            assertTrue("Scroll to Right of Pane "
+                    + "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
+                    + "< currentValue, actual value = " + currentValue + ")",
+                    initialHorizontalValue < currentValue);
+        }
     }
 
 }
--- a/jdk/test/sanity/client/SwingSet/src/SpinnerDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/SpinnerDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.spinner.SpinnerDemo;
 import static com.sun.swingset3.demos.spinner.SpinnerDemo.DEMO_TITLE;
 import java.text.DecimalFormat;
@@ -30,7 +31,7 @@
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JSpinnerOperator;
 import org.netbeans.jemmy.operators.JTextFieldOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -39,12 +40,13 @@
  *          the spinner button and checking text field value.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.spinner.SpinnerDemo
  * @run testng SpinnerDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class SpinnerDemoTest {
 
     private static final int SPINNERS_COUNT = 9;
@@ -52,16 +54,14 @@
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(SpinnerDemo.class.getCanonicalName()).startApplication();
+        new ClassReference(SpinnerDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
 
-            // Check changing different spinners
-            for (int i = 0; i < SPINNERS_COUNT; i++) {
-                changeValues(frame, i);
-            }
-        });
+        // Check changing different spinners
+        for (int i = 0; i < SPINNERS_COUNT; i++) {
+            changeValues(frame, i);
+        }
     }
 
     private void changeValues(JFrameOperator jfo, int spinnerIndex) throws Exception {
--- a/jdk/test/sanity/client/SwingSet/src/SplitPaneDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/SplitPaneDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.splitpane.SplitPaneDemo;
 import static com.sun.swingset3.demos.splitpane.SplitPaneDemo.*;
 import java.awt.event.KeyEvent;
@@ -35,6 +36,7 @@
 import org.netbeans.jemmy.operators.JSplitPaneOperator;
 import org.netbeans.jemmy.operators.JTextFieldOperator;
 import static org.jemmy2ext.JemmyExt.*;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -44,39 +46,39 @@
  *          and changing the divider orientation.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.splitpane.SplitPaneDemo
  * @run testng SplitPaneDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class SplitPaneDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
 
-            JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
+        JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
 
-            // Toggle OneTouch Expandable
-            checkOneTouch(frame, splitPane, true);
-            checkOneTouch(frame, splitPane, false);
+        // Toggle OneTouch Expandable
+        checkOneTouch(frame, splitPane, true);
+        checkOneTouch(frame, splitPane, false);
 
-            // Check changing divider size to minimum and maximum values
-            changeDividerSize(frame, splitPane, 50);
-            changeDividerSize(frame, splitPane, 6);
+        // Check changing divider size to minimum and maximum values
+        changeDividerSize(frame, splitPane, 50);
+        changeDividerSize(frame, splitPane, 6);
 
-            // Check moving the divider
-            checkDividerMoves(frame, splitPane, false);
-            checkDividerMoves(frame, splitPane, true);
+        // Check moving the divider
+        checkDividerMoves(frame, splitPane, false);
+        checkDividerMoves(frame, splitPane, true);
 
-            // Check different minumum Day/Night sizes
-            changeMinimumSizes(frame, splitPane, 100);
-            changeMinimumSizes(frame, splitPane, 0);
-        });
+        // Check different minumum Day/Night sizes
+        changeMinimumSizes(frame, splitPane, 100);
+        changeMinimumSizes(frame, splitPane, 0);
     }
 
     // Check for different day and night minimum size
--- a/jdk/test/sanity/client/SwingSet/src/TabbedPaneDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/TabbedPaneDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo;
 import static com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo.*;
 import static org.jemmy2ext.JemmyExt.getLabeledContainerOperator;
@@ -31,7 +32,7 @@
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JRadioButtonOperator;
 import org.netbeans.jemmy.operators.JTabbedPaneOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -40,25 +41,24 @@
  *          positions, opening each tab and verifying the the tab gets selected.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo
  * @run testng TabbedPaneDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class TabbedPaneDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
+        new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
+        JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
 
-            for (String tp : new String[]{TOP, LEFT, BOTTOM, RIGHT}) {
-                testTabs(mainFrame, tp);
-            }
-        });
+        for (String tp : new String[]{TOP, LEFT, BOTTOM, RIGHT}) {
+            testTabs(mainFrame, tp);
+        }
     }
 
     public void testTabs(JFrameOperator mainFrame, String tabPlacement) throws Exception {
--- a/jdk/test/sanity/client/SwingSet/src/TextFieldDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/TextFieldDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.textfield.JHistoryTextField;
 import com.sun.swingset3.demos.textfield.TextFieldDemo;
 import static com.sun.swingset3.demos.textfield.TextFieldDemo.*;
@@ -41,6 +42,7 @@
 import org.netbeans.jemmy.operators.JLabelOperator;
 import org.netbeans.jemmy.operators.JPasswordFieldOperator;
 import org.netbeans.jemmy.operators.JTextFieldOperator;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -49,25 +51,25 @@
  *          checking that app reacts accordingly.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.textfield.TextFieldDemo
  * @run testng TextFieldDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class TextFieldDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication();
 
-            historyTextField(frame);
-            dateTextField(frame);
-            passwordField(frame);
-        });
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+
+        historyTextField(frame);
+        dateTextField(frame);
+        passwordField(frame);
     }
 
     private void historyTextField(JFrameOperator jfo) throws Exception {
--- a/jdk/test/sanity/client/SwingSet/src/ToggleButtonDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/ToggleButtonDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.DemoProperties;
 import com.sun.swingset3.demos.togglebutton.DirectionPanel;
 import com.sun.swingset3.demos.togglebutton.LayoutControlPanel;
@@ -40,7 +41,7 @@
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JRadioButtonOperator;
 import org.netbeans.jemmy.operators.JTabbedPaneOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -53,50 +54,49 @@
  *          selected.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.togglebutton.ToggleButtonDemo
  * @run testng ToggleButtonDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class ToggleButtonDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();
+        new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
-            JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame);
+        JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
+        JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame);
 
-            // Radio Button Toggles
-            testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null);
-            testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null);
-            testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t));
+        // Radio Button Toggles
+        testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null);
+        testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null);
+        testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t));
 
-            // switch to the Check Boxes Tab
-            tabPane.selectPage(CHECK_BOXES);
+        // switch to the Check Boxes Tab
+        tabPane.selectPage(CHECK_BOXES);
 
-            // Check Box Toggles
-            ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES);
-            testCheckBox(textCheckBoxesJPanel, CHECK1, false);
-            testCheckBox(textCheckBoxesJPanel, CHECK2, false);
-            testCheckBox(textCheckBoxesJPanel, CHECK3, false);
+        // Check Box Toggles
+        ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES);
+        testCheckBox(textCheckBoxesJPanel, CHECK1, false);
+        testCheckBox(textCheckBoxesJPanel, CHECK2, false);
+        testCheckBox(textCheckBoxesJPanel, CHECK3, false);
 
-            ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES);
-            testCheckBox(imageCheckBoxesJPanel, CHECK1, false);
-            testCheckBox(imageCheckBoxesJPanel, CHECK2, false);
-            testCheckBox(imageCheckBoxesJPanel, CHECK3, false);
+        ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES);
+        testCheckBox(imageCheckBoxesJPanel, CHECK1, false);
+        testCheckBox(imageCheckBoxesJPanel, CHECK2, false);
+        testCheckBox(imageCheckBoxesJPanel, CHECK3, false);
 
-            ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS);
-            testCheckBox(displayOptionsContainer, PAINT_BORDER, false);
-            testCheckBox(displayOptionsContainer, PAINT_FOCUS, true);
-            testCheckBox(displayOptionsContainer, ENABLED, true);
-            testCheckBox(displayOptionsContainer, CONTENT_FILLED, true);
+        ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS);
+        testCheckBox(displayOptionsContainer, PAINT_BORDER, false);
+        testCheckBox(displayOptionsContainer, PAINT_FOCUS, true);
+        testCheckBox(displayOptionsContainer, ENABLED, true);
+        testCheckBox(displayOptionsContainer, CONTENT_FILLED, true);
 
-            // Direction Button Toggles
-            testToggleButtons(mainFrame);
-        });
+        // Direction Button Toggles
+        testToggleButtons(mainFrame);
     }
 
     /**
--- a/jdk/test/sanity/client/SwingSet/src/TreeDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/TreeDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.tree.TreeDemo;
 import static com.sun.swingset3.demos.tree.TreeDemo.DEMO_TITLE;
 import javax.swing.tree.TreePath;
@@ -29,7 +30,7 @@
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JTreeOperator;
-import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -42,67 +43,67 @@
  *          vertically (as ScrollPane allows it).
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.tree.TreeDemo
  * @run testng TreeDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class TreeDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(TreeDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        new ClassReference(TreeDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
 
-            JTreeOperator tree = new JTreeOperator(frame);
+        JTreeOperator tree = new JTreeOperator(frame);
 
-            assertEquals("Initial number of rows in the tree", 4, tree.getRowCount());
+        assertEquals("Initial number of rows in the tree", 4, tree.getRowCount());
 
-            int initialTreeHeight = tree.getHeight();
+        int initialTreeHeight = tree.getHeight();
 
-            // expand all nodes
-            int expandsCount = 0;
-            for (int i = 0; i < tree.getRowCount(); i++) {
-                TreePath tp = tree.getPathForRow(i);
-                if (tree.getChildCount(tp) > 0 && !tree.isExpanded(tp)) {
-                    tree.expandRow(i);
-                    expandsCount++;
-                }
+        // expand all nodes
+        int expandsCount = 0;
+        for (int i = 0; i < tree.getRowCount(); i++) {
+            TreePath tp = tree.getPathForRow(i);
+            if (tree.getChildCount(tp) > 0 && !tree.isExpanded(tp)) {
+                tree.expandRow(i);
+                expandsCount++;
             }
+        }
 
-            assertEquals("Number of rows expanded", 75, expandsCount);
-            assertEquals("Number of rows in the tree after expanding all of them",
-                    616, tree.getRowCount());
+        assertEquals("Number of rows expanded", 75, expandsCount);
+        assertEquals("Number of rows in the tree after expanding all of them",
+                616, tree.getRowCount());
 
-            int expandedTreeHeight = tree.getHeight();
-            assertTrue("Expanded tree height has increased, current "
-                    + expandedTreeHeight + " > initial " + initialTreeHeight,
-                    expandedTreeHeight > initialTreeHeight);
+        int expandedTreeHeight = tree.getHeight();
+        assertTrue("Expanded tree height has increased, current "
+                + expandedTreeHeight + " > initial " + initialTreeHeight,
+                expandedTreeHeight > initialTreeHeight);
 
-            // collapse all nodes
-            int collapsesCount = 0;
-            for (int i = tree.getRowCount() - 1; i >= 0; i--) {
-                TreePath tp = tree.getPathForRow(i);
-                if (tree.getChildCount(tp) > 0 && tree.isExpanded(tp)) {
-                    tree.collapseRow(i);
-                    collapsesCount++;
-                }
+        // collapse all nodes
+        int collapsesCount = 0;
+        for (int i = tree.getRowCount() - 1; i >= 0; i--) {
+            TreePath tp = tree.getPathForRow(i);
+            if (tree.getChildCount(tp) > 0 && tree.isExpanded(tp)) {
+                tree.collapseRow(i);
+                collapsesCount++;
             }
+        }
 
-            assertEquals("Number of rows collapsed", 76, collapsesCount);
-            assertEquals("Number of rows in the tree after collapsing all of them",
-                    1, tree.getRowCount());
+        assertEquals("Number of rows collapsed", 76, collapsesCount);
+        assertEquals("Number of rows in the tree after collapsing all of them",
+                1, tree.getRowCount());
 
-            int collapsedTreeHeight = tree.getHeight();
-            assertTrue("Collpased tree height is not longer than initial, "
-                    + "current " + collapsedTreeHeight + " <= initial "
-                    + initialTreeHeight,
-                    collapsedTreeHeight <= initialTreeHeight);
+        int collapsedTreeHeight = tree.getHeight();
+        assertTrue("Collpased tree height is not longer than initial, "
+                + "current " + collapsedTreeHeight + " <= initial "
+                + initialTreeHeight,
+                collapsedTreeHeight <= initialTreeHeight);
 
-        });
     }
 
 }
--- a/jdk/test/sanity/client/SwingSet/src/WindowDemoTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/SwingSet/src/WindowDemoTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import org.jtregext.GuiTestListener;
 import com.sun.swingset3.demos.window.WindowDemo;
 import static com.sun.swingset3.demos.window.WindowDemo.*;
 import static org.jemmy2ext.JemmyExt.*;
@@ -31,6 +32,7 @@
 import org.netbeans.jemmy.operators.JFrameOperator;
 import org.netbeans.jemmy.operators.JLabelOperator;
 import org.netbeans.jemmy.operators.WindowOperator;
+import org.testng.annotations.Listeners;
 
 /*
  * @test
@@ -40,37 +42,37 @@
  *          when the "Show JWindow..." button is clicked.
  *
  * @library /sanity/client/lib/jemmy/src
- * @library /sanity/client/lib/Jemmy2Ext/src
+ * @library /sanity/client/lib/Extensions/src
  * @library /sanity/client/lib/SwingSet3/src
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.window.WindowDemo
  * @run testng WindowDemoTest
  */
+@Listeners(GuiTestListener.class)
 public class WindowDemoTest {
 
     @Test
     public void test() throws Exception {
-        captureDebugInfoOnFail(() -> {
-            new ClassReference(WindowDemo.class.getCanonicalName()).startApplication();
+
+        new ClassReference(WindowDemo.class.getCanonicalName()).startApplication();
 
-            JFrameOperator frame = new JFrameOperator();
+        JFrameOperator frame = new JFrameOperator();
 
-            assertEquals("Only one JWindow is shown", 1, getJWindowCount());
+        assertEquals("Only one JWindow is shown", 1, getJWindowCount());
 
-            WindowOperator window = new WindowOperator(getJWindow());
+        WindowOperator window = new WindowOperator(getJWindow());
 
-            assertTrue("JFrame is showing", frame.isShowing());
-            assertFalse("JFrame is not iconified", isIconified(frame));
-            assertTrue("JWindow is showing", window.isShowing());
+        assertTrue("JFrame is showing", frame.isShowing());
+        assertFalse("JFrame is not iconified", isIconified(frame));
+        assertTrue("JWindow is showing", window.isShowing());
 
-            final String labelText = I_HAVE_NO_SYSTEM_BORDER;
-            JLabelOperator jLabelOperator = new JLabelOperator(window, labelText);
-            assertEquals("JWindow contains the label with corresponding text", labelText, jLabelOperator.getText());
+        final String labelText = I_HAVE_NO_SYSTEM_BORDER;
+        JLabelOperator jLabelOperator = new JLabelOperator(window, labelText);
+        assertEquals("JWindow contains the label with corresponding text", labelText, jLabelOperator.getText());
 
-            new JButtonOperator(frame, SHOW_J_WINDOW).push();
+        new JButtonOperator(frame, SHOW_J_WINDOW).push();
 
-            assertEquals("Only one JWindow is shown", 1, getJWindowCount());
-        });
+        assertEquals("Only one JWindow is shown", 1, getJWindowCount());
     }
 
 }
--- a/jdk/test/sanity/client/TEST.ROOT.template	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/TEST.ROOT.template	Fri Apr 29 11:54:18 2016 -0700
@@ -12,7 +12,7 @@
 # A "headful" test requires a graphical environment to meaningfully
 # run. Tests that are not headful are "headless." 
 
-keys=screenshots
+keys=2d dnd i18n intermittent randomness headful
 
 # Tests that must run in othervm mode
 othervm.dirs=sanity/client/SwingSet
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sanity/client/lib/Extensions/src/org/jemmy2ext/JemmyExt.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,613 @@
+/*
+ * Copyright (c) 2015, 2016, 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.
+ */
+package org.jemmy2ext;
+
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Window;
+import java.awt.image.BufferedImage;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Function;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.stream.IntStream;
+import javax.imageio.ImageIO;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JWindow;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
+import org.netbeans.jemmy.ComponentChooser;
+import org.netbeans.jemmy.DefaultCharBindingMap;
+import org.netbeans.jemmy.QueueTool;
+import org.netbeans.jemmy.TimeoutExpiredException;
+import org.netbeans.jemmy.Waitable;
+import org.netbeans.jemmy.Waiter;
+import org.netbeans.jemmy.drivers.scrolling.JSpinnerDriver;
+import org.netbeans.jemmy.image.StrictImageComparator;
+import org.netbeans.jemmy.operators.ComponentOperator;
+import org.netbeans.jemmy.operators.ContainerOperator;
+import org.netbeans.jemmy.operators.FrameOperator;
+import org.netbeans.jemmy.operators.JButtonOperator;
+import org.netbeans.jemmy.operators.JFrameOperator;
+import org.netbeans.jemmy.operators.JLabelOperator;
+import org.netbeans.jemmy.operators.Operator;
+import org.netbeans.jemmy.util.Dumper;
+import org.netbeans.jemmy.util.PNGEncoder;
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class solves two tasks: 1. It adds functionality that is missing in
+ * Jemmy 2. It references all the Jemmy API that is needed by tests so that they
+ * can just @build JemmyExt class and do not worry about Jemmy
+ *
+ * @author akouznet
+ */
+public class JemmyExt {
+
+    /**
+     * Statically referencing all the classes that are needed by tests so that
+     * they're compiled by jtreg
+     */
+    static final Class<?>[] DEPENDENCIES = {
+        JSpinnerDriver.class,
+        DefaultCharBindingMap.class
+    };
+
+    public static void assertNotBlack(BufferedImage image) {
+        int w = image.getWidth();
+        int h = image.getHeight();
+        try {
+            assertFalse("All pixels are not black", IntStream.range(0, w).parallel().allMatch(x
+                    -> IntStream.range(0, h).allMatch(y -> (image.getRGB(x, y) & 0xffffff) == 0)
+            ));
+        } catch (Throwable t) {
+            save(image, "allPixelsAreBlack.png");
+            throw t;
+        }
+    }
+
+    public static void waitArmed(JButtonOperator button) {
+        button.waitState(new ComponentChooser() {
+
+            @Override
+            public boolean checkComponent(Component comp) {
+                return isArmed(button);
+            }
+
+            @Override
+            public String getDescription() {
+                return "Button is armed";
+            }
+        });
+    }
+
+    public static boolean isArmed(JButtonOperator button) {
+        return button.getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Boolean>("getModel().isArmed()") {
+
+            @Override
+            public Boolean launch() throws Exception {
+                return ((JButton) button.getSource()).getModel().isArmed();
+            }
+        });
+    }
+
+    public static void waitPressed(JButtonOperator button) {
+        button.waitState(new ComponentChooser() {
+
+            @Override
+            public boolean checkComponent(Component comp) {
+                return isPressed(button);
+            }
+
+            @Override
+            public String getDescription() {
+                return "Button is pressed";
+            }
+        });
+    }
+
+    public static boolean isPressed(JButtonOperator button) {
+        return button.getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Boolean>("getModel().isPressed()") {
+
+            @Override
+            public Boolean launch() throws Exception {
+                return ((JButton) button.getSource()).getModel().isPressed();
+            }
+        });
+    }
+
+    public static void assertEquals(String string, StrictImageComparator comparator, BufferedImage expected, BufferedImage actual) {
+        try {
+            assertTrue(string, comparator.compare(expected, actual));
+        } catch (Error err) {
+            save(expected, "expected.png");
+            save(actual, "actual.png");
+            throw err;
+        }
+    }
+
+    public static void assertNotEquals(String string, StrictImageComparator comparator, BufferedImage notExpected, BufferedImage actual) {
+        try {
+            assertFalse(string, comparator.compare(notExpected, actual));
+        } catch (Error err) {
+            save(notExpected, "notExpected.png");
+            save(actual, "actual.png");
+            throw err;
+        }
+    }
+
+    public static void save(BufferedImage image, String filename) {
+        String filepath = filename;
+        try {
+            filepath = new File(filename).getCanonicalPath();
+            System.out.println("Saving screenshot to " + filepath);
+            BufferedOutputStream file = new BufferedOutputStream(new FileOutputStream(filepath));
+            new PNGEncoder(file, PNGEncoder.COLOR_MODE).encode(image);
+        } catch (IOException ioe) {
+            throw new RuntimeException("Failed to save image to " + filepath, ioe);
+        }
+    }
+
+    public static void waitImageIsStill(Robot rob, ComponentOperator operator) {
+        operator.waitState(new ComponentChooser() {
+
+            private BufferedImage previousImage = null;
+            private int index = 0;
+            private final StrictImageComparator sComparator = new StrictImageComparator();
+
+            @Override
+            public boolean checkComponent(Component comp) {
+                BufferedImage currentImage = capture(rob, operator);
+                save(currentImage, "waitImageIsStill" + index + ".png");
+                index++;
+                boolean compareResult = previousImage == null ? false : sComparator.compare(currentImage, previousImage);
+                previousImage = currentImage;
+                return compareResult;
+            }
+
+            @Override
+            public String getDescription() {
+                return "Image of " + operator + " is still";
+            }
+        });
+    }
+
+    private static class ThrowableHolder {
+
+        volatile Throwable t;
+    }
+
+    public static void waitFor(String description, RunnableWithException r) throws Exception {
+        Waiter<Boolean, ThrowableHolder> waiter = new Waiter<>(new Waitable<Boolean, ThrowableHolder>() {
+
+            @Override
+            public Boolean actionProduced(ThrowableHolder obj) {
+                try {
+                    r.run();
+                    return true;
+                } catch (Throwable t) {
+                    obj.t = t;
+                    return null;
+                }
+            }
+
+            @Override
+            public String getDescription() {
+                return description;
+            }
+        });
+        ThrowableHolder th = new ThrowableHolder();
+        try {
+            waiter.waitAction(th);
+        } catch (TimeoutExpiredException tee) {
+            Throwable t = th.t;
+            if (t != null) {
+                t.addSuppressed(tee);
+                if (t instanceof Exception) {
+                    throw (Exception) t;
+                } else if (t instanceof Error) {
+                    throw (Error) t;
+                } else if (t instanceof RuntimeException) {
+                    throw (RuntimeException) t;
+                } else {
+                    throw new IllegalStateException("Unexpected exception type", t);
+                }
+            }
+        }
+    }
+
+    public static BufferedImage capture(Robot rob, ComponentOperator operator) {
+        Rectangle boundary = new Rectangle(operator.getLocationOnScreen(),
+                operator.getSize());
+        return rob.createScreenCapture(boundary);
+    }
+
+    /**
+     * Dispose all AWT/Swing windows causing event thread to stop
+     */
+    public static void disposeAllWindows() {
+        System.out.println("disposeAllWindows");
+        try {
+            EventQueue.invokeAndWait(() -> {
+                Window[] windows = Window.getWindows();
+                for (Window w : windows) {
+                    w.dispose();
+                }
+            });
+        } catch (InterruptedException | InvocationTargetException ex) {
+            Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, "Failed to dispose all windows", ex);
+        }
+    }
+
+    /**
+     * This is a helper class which allows to catch throwables thrown in other
+     * threads and throw them in the main test thread
+     */
+    public static class MultiThreadedTryCatch {
+
+        private final List<Throwable> throwables
+                = Collections.synchronizedList(new ArrayList<>());
+
+        /**
+         * Throws registered throwables. If the list of the registered
+         * throwables is not empty, it re-throws the first throwable in the list
+         * adding all others into its suppressed list. Can be used in any
+         * thread.
+         *
+         * @throws Exception
+         */
+        public void throwRegistered() throws Exception {
+            Throwable root = null;
+            synchronized (throwables) {
+                if (!throwables.isEmpty()) {
+                    root = throwables.remove(0);
+                    while (!throwables.isEmpty()) {
+                        root.addSuppressed(throwables.remove(0));
+                    }
+                }
+            }
+            if (root != null) {
+                if (root instanceof Error) {
+                    throw (Error) root;
+                } else if (root instanceof Exception) {
+                    throw (Exception) root;
+                } else {
+                    throw new AssertionError("Unexpected exception type: " + root.getClass() + " (" + root + ")");
+                }
+            }
+        }
+
+        /**
+         * Registers a throwable and adds it to the list of throwables. Can be
+         * used in any thread.
+         *
+         * @param t
+         */
+        public void register(Throwable t) {
+            t.printStackTrace();
+            throwables.add(t);
+        }
+
+        /**
+         * Registers a throwable and adds it as the first item of the list of
+         * catched throwables.
+         *
+         * @param t
+         */
+        public void registerRoot(Throwable t) {
+            t.printStackTrace();
+            throwables.add(0, t);
+        }
+    }
+
+    /**
+     * Trying to capture as much information as possible. Currently it includes
+     * full dump and a screenshot of the whole screen.
+     */
+    public static void captureAll() {
+        PNGEncoder.captureScreen("failure.png", PNGEncoder.COLOR_MODE);
+        try {
+            Dumper.dumpAll("dumpAll.xml");
+        } catch (FileNotFoundException ex) {
+            Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        captureWindows();
+    }
+
+    /**
+     * Captures each showing window image using Window.paint() method.
+     */
+    private static void captureWindows() {
+        try {
+            EventQueue.invokeAndWait(() -> {
+                Window[] windows = Window.getWindows();
+                int index = 0;
+                for (Window w : windows) {
+                    if (!w.isShowing()) {
+                        continue;
+                    }
+                    BufferedImage img = new BufferedImage(w.getWidth(), w.getHeight(), BufferedImage.TYPE_INT_ARGB);
+                    Graphics g = img.getGraphics();
+                    w.paint(g);
+                    g.dispose();
+
+                    try {
+                        ImageIO.write(img, "png", new File("window" + index++ + ".png"));
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        } catch (InterruptedException | InvocationTargetException ex) {
+            Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+
+    public static interface RunnableWithException {
+
+        public void run() throws Exception;
+    }
+
+    public static void waitIsFocused(JFrameOperator jfo) {
+        jfo.waitState(new ComponentChooser() {
+
+            @Override
+            public boolean checkComponent(Component comp) {
+                return jfo.isFocused();
+            }
+
+            @Override
+            public String getDescription() {
+                return "JFrame is focused";
+            }
+        });
+    }
+
+    public static int getJWindowCount() {
+        return new QueueTool().invokeAndWait(new QueueTool.QueueAction<Integer>(null) {
+
+            @Override
+            public Integer launch() throws Exception {
+                Window[] windows = Window.getWindows();
+                int windowCount = 0;
+                for (Window w : windows) {
+                    if (w.getClass().equals(JWindow.class)) {
+                        windowCount++;
+                    }
+                }
+                return windowCount;
+            }
+        });
+    }
+
+    public static JWindow getJWindow() {
+        return getJWindow(0);
+    }
+
+    public static JWindow getJWindow(int index) {
+        return new QueueTool().invokeAndWait(new QueueTool.QueueAction<JWindow>(null) {
+
+            @Override
+            public JWindow launch() throws Exception {
+                Window[] windows = Window.getWindows();
+                int windowIndex = 0;
+                for (Window w : windows) {
+                    if (w.getClass().equals(JWindow.class)) {
+                        if (windowIndex == index) {
+                            return (JWindow) w;
+                        }
+                        windowIndex++;
+                    }
+                }
+                return null;
+            }
+        });
+    }
+
+    public static boolean isIconified(FrameOperator frameOperator) {
+        return frameOperator.getQueueTool().invokeAndWait(new QueueTool.QueueAction<Boolean>("Frame is iconified") {
+
+            @Override
+            public Boolean launch() throws Exception {
+                return (((Frame) frameOperator.getSource()).getState() & Frame.ICONIFIED) != 0;
+            }
+        });
+    }
+
+    public static final Operator.DefaultStringComparator EXACT_STRING_COMPARATOR
+            = new Operator.DefaultStringComparator(true, true);
+
+    /**
+     * Finds a label with the exact labelText and returns the operator for its
+     * parent container.
+     *
+     * @param container
+     * @param labelText
+     * @return
+     */
+    public static ContainerOperator<?> getLabeledContainerOperator(ContainerOperator<?> container, String labelText) {
+
+        container.setComparator(EXACT_STRING_COMPARATOR);
+
+        JLabelOperator jLabelOperator = new JLabelOperator(container, labelText);
+
+        assert labelText.equals(jLabelOperator.getText());
+
+        return new ContainerOperator<>(jLabelOperator.getParent());
+    }
+
+    /**
+     * Finds a JPanel with exact title text.
+     *
+     * @param container
+     * @param titleText
+     * @return
+     */
+    public static ContainerOperator<?> getBorderTitledJPanelOperator(ContainerOperator<?> container, String titleText) {
+        return new ContainerOperator<>(container, new JPanelByBorderTitleFinder(titleText, EXACT_STRING_COMPARATOR));
+    }
+
+    public static final QueueTool QUEUE_TOOL = new QueueTool();
+
+    /**
+     * Allows to find JPanel by the title text in its border.
+     */
+    public static class JPanelByBorderTitleFinder implements ComponentChooser {
+
+        String titleText;
+        Operator.StringComparator comparator;
+
+        /**
+         * @param titleText title text pattern
+         * @param comparator specifies string comparison algorithm.
+         */
+        public JPanelByBorderTitleFinder(String titleText, Operator.StringComparator comparator) {
+            this.titleText = titleText;
+            this.comparator = comparator;
+        }
+
+        /**
+         * @param titleText title text pattern
+         */
+        public JPanelByBorderTitleFinder(String titleText) {
+            this(titleText, Operator.getDefaultStringComparator());
+        }
+
+        @Override
+        public boolean checkComponent(Component comp) {
+            assert EventQueue.isDispatchThread();
+            if (comp instanceof JPanel) {
+                return checkBorder(((JPanel) comp).getBorder());
+            }
+            return false;
+        }
+
+        public boolean checkBorder(Border border) {
+            if (border instanceof TitledBorder) {
+                String title = ((TitledBorder) border).getTitle();
+                return comparator.equals(title, titleText);
+            } else if (border instanceof CompoundBorder) {
+                CompoundBorder compoundBorder = (CompoundBorder) border;
+                return checkBorder(compoundBorder.getInsideBorder()) || checkBorder(compoundBorder.getOutsideBorder());
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        public String getDescription() {
+            return ("JPanel with border title text \"" + titleText + "\" with comparator " + comparator);
+        }
+    }
+
+    public static class ByClassSimpleNameChooser implements ComponentChooser {
+
+        private final String className;
+
+        public ByClassSimpleNameChooser(String className) {
+            this.className = className;
+        }
+
+        @Override
+        public boolean checkComponent(Component comp) {
+            return comp.getClass().getSimpleName().equals(className);
+        }
+
+        @Override
+        public String getDescription() {
+            return "Component with the simple class name of " + className;
+        }
+
+    }
+
+    public static class ByClassChooser implements ComponentChooser {
+
+        private final Class<?> clazz;
+
+        public ByClassChooser(Class<?> clazz) {
+            this.clazz = clazz;
+        }
+
+        @Override
+        public boolean checkComponent(Component comp) {
+            return comp.getClass().equals(clazz);
+        }
+
+        @Override
+        public String getDescription() {
+            return "Component with the class of " + clazz;
+        }
+
+    }
+
+    public static class ByToolTipChooser implements ComponentChooser {
+
+        private final String tooltip;
+
+        public ByToolTipChooser(String tooltip) {
+            if (tooltip == null) {
+                throw new NullPointerException("Tooltip cannot be null");
+            }
+            this.tooltip = tooltip;
+        }
+
+        @Override
+        public boolean checkComponent(Component comp) {
+            return (comp instanceof JComponent)
+                    ? tooltip.equals(((JComponent) comp).getToolTipText())
+                    : false;
+        }
+
+        @Override
+        public String getDescription() {
+            return "JComponent with the tooltip '" + tooltip + "'";
+        }
+
+    }
+
+    @SuppressWarnings(value = "unchecked")
+    public static <R, O extends Operator, S extends Component> R getUIValue(O operator, Function<S, R> getter) {
+        return operator.getQueueTool().invokeSmoothly(new QueueTool.QueueAction<R>("getting UI value through the queue using " + getter) {
+
+            @Override
+            public R launch() throws Exception {
+                return getter.apply((S) operator.getSource());
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sanity/client/lib/Extensions/src/org/jtregext/GuiTestListener.java	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,72 @@
+package org.jtregext;
+
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import org.jemmy2ext.JemmyExt;
+import static org.jemmy2ext.JemmyExt.captureAll;
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+
+// TODO: Remove this once https://bugs.openjdk.java.net/browse/JDK-8151671 is fixed
+public class GuiTestListener implements ITestListener {
+
+    private void afterTest() {
+        JemmyExt.disposeAllWindows();
+    }
+
+    @Override
+    public void onTestStart(ITestResult result) {
+    }
+
+    @Override
+    public void onTestSuccess(ITestResult result) {
+        System.out.println("TEST PASSED");
+        afterTest();
+    }
+
+    @Override
+    public void onTestFailure(ITestResult result) {
+        captureAll();
+        afterTest();
+    }
+
+    @Override
+    public void onTestSkipped(ITestResult result) {
+    }
+
+    @Override
+    public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
+    }
+
+    @Override
+    public void onStart(ITestContext context) {
+    }
+
+    @Override
+    public void onFinish(ITestContext context) {
+    }
+
+}
--- a/jdk/test/sanity/client/lib/Jemmy2Ext/src/org/jemmy2ext/JemmyExt.java	Fri Apr 29 11:14:56 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,614 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, 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.
- */
-package org.jemmy2ext;
-
-import java.awt.Component;
-import java.awt.EventQueue;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.Rectangle;
-import java.awt.Robot;
-import java.awt.Window;
-import java.awt.image.BufferedImage;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.IntStream;
-import javax.imageio.ImageIO;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JWindow;
-import javax.swing.border.Border;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.TitledBorder;
-import org.netbeans.jemmy.ComponentChooser;
-import org.netbeans.jemmy.DefaultCharBindingMap;
-import org.netbeans.jemmy.QueueTool;
-import org.netbeans.jemmy.TimeoutExpiredException;
-import org.netbeans.jemmy.Waitable;
-import org.netbeans.jemmy.Waiter;
-import org.netbeans.jemmy.drivers.scrolling.JSpinnerDriver;
-import org.netbeans.jemmy.image.StrictImageComparator;
-import org.netbeans.jemmy.operators.ComponentOperator;
-import org.netbeans.jemmy.operators.ContainerOperator;
-import org.netbeans.jemmy.operators.FrameOperator;
-import org.netbeans.jemmy.operators.JButtonOperator;
-import org.netbeans.jemmy.operators.JFrameOperator;
-import org.netbeans.jemmy.operators.JLabelOperator;
-import org.netbeans.jemmy.operators.Operator;
-import org.netbeans.jemmy.util.Dumper;
-import org.netbeans.jemmy.util.PNGEncoder;
-import static org.testng.AssertJUnit.*;
-
-/**
- * This class solves two tasks: 1. It adds functionality that is missing in
- * Jemmy 2. It references all the Jemmy API that is needed by tests so that they
- * can just @build JemmyExt class and do not worry about Jemmy
- *
- * @author akouznet
- */
-public class JemmyExt {
-
-    /**
-     * Statically referencing all the classes that are needed by tests so that
-     * they're compiled by jtreg
-     */
-    static final Class<?>[] DEPENDENCIES = {
-        JSpinnerDriver.class,
-        DefaultCharBindingMap.class
-    };
-
-    public static void assertNotBlack(BufferedImage image) {
-        int w = image.getWidth();
-        int h = image.getHeight();
-        try {
-            assertFalse("All pixels are not black", IntStream.range(0, w).parallel().allMatch(x
-                    -> IntStream.range(0, h).allMatch(y -> (image.getRGB(x, y) & 0xffffff) == 0)
-            ));
-        } catch (Throwable t) {
-            save(image, "allPixelsAreBlack.png");
-            throw t;
-        }
-    }
-
-    public static void waitArmed(JButtonOperator button) {
-        button.waitState(new ComponentChooser() {
-
-            @Override
-            public boolean checkComponent(Component comp) {
-                return isArmed(button);
-            }
-
-            @Override
-            public String getDescription() {
-                return "Button is armed";
-            }
-        });
-    }
-
-    public static boolean isArmed(JButtonOperator button) {
-        return button.getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Boolean>("getModel().isArmed()") {
-
-            @Override
-            public Boolean launch() throws Exception {
-                return ((JButton) button.getSource()).getModel().isArmed();
-            }
-        });
-    }
-
-    public static void waitPressed(JButtonOperator button) {
-        button.waitState(new ComponentChooser() {
-
-            @Override
-            public boolean checkComponent(Component comp) {
-                return isPressed(button);
-            }
-
-            @Override
-            public String getDescription() {
-                return "Button is pressed";
-            }
-        });
-    }
-
-    public static boolean isPressed(JButtonOperator button) {
-        return button.getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Boolean>("getModel().isPressed()") {
-
-            @Override
-            public Boolean launch() throws Exception {
-                return ((JButton) button.getSource()).getModel().isPressed();
-            }
-        });
-    }
-
-    public static void assertEquals(String string, StrictImageComparator comparator, BufferedImage expected, BufferedImage actual) {
-        try {
-            assertTrue(string, comparator.compare(expected, actual));
-        } catch (Error err) {
-            save(expected, "expected.png");
-            save(actual, "actual.png");
-            throw err;
-        }
-    }
-
-    public static void assertNotEquals(String string, StrictImageComparator comparator, BufferedImage notExpected, BufferedImage actual) {
-        try {
-            assertFalse(string, comparator.compare(notExpected, actual));
-        } catch (Error err) {
-            save(notExpected, "notExpected.png");
-            save(actual, "actual.png");
-            throw err;
-        }
-    }
-
-    public static void save(BufferedImage image, String filename) {
-        String filepath = filename;
-        try {
-            filepath = new File(filename).getCanonicalPath();
-            System.out.println("Saving screenshot to " + filepath);
-            BufferedOutputStream file = new BufferedOutputStream(new FileOutputStream(filepath));
-            new PNGEncoder(file, PNGEncoder.COLOR_MODE).encode(image);
-        } catch (IOException ioe) {
-            throw new RuntimeException("Failed to save image to " + filepath, ioe);
-        }
-    }
-
-    public static void waitImageIsStill(Robot rob, ComponentOperator operator) {
-        operator.waitState(new ComponentChooser() {
-
-            private BufferedImage previousImage = null;
-            private int index = 0;
-            private final StrictImageComparator sComparator = new StrictImageComparator();
-
-            @Override
-            public boolean checkComponent(Component comp) {
-                BufferedImage currentImage = capture(rob, operator);
-                save(currentImage, "waitImageIsStill" + index + ".png");
-                index++;
-                boolean compareResult = previousImage == null ? false : sComparator.compare(currentImage, previousImage);
-                previousImage = currentImage;
-                return compareResult;
-            }
-
-            @Override
-            public String getDescription() {
-                return "Image of " + operator + " is still";
-            }
-        });
-    }
-
-    private static class ThrowableHolder {
-
-        volatile Throwable t;
-    }
-
-    public static void waitFor(String description, RunnableWithException r) throws Exception {
-        Waiter<Boolean, ThrowableHolder> waiter = new Waiter<>(new Waitable<Boolean, ThrowableHolder>() {
-
-            @Override
-            public Boolean actionProduced(ThrowableHolder obj) {
-                try {
-                    r.run();
-                    return true;
-                } catch (Throwable t) {
-                    obj.t = t;
-                    return null;
-                }
-            }
-
-            @Override
-            public String getDescription() {
-                return description;
-            }
-        });
-        ThrowableHolder th = new ThrowableHolder();
-        try {
-            waiter.waitAction(th);
-        } catch (TimeoutExpiredException tee) {
-            Throwable t = th.t;
-            if (t != null) {
-                t.addSuppressed(tee);
-                if (t instanceof Exception) {
-                    throw (Exception) t;
-                } else if (t instanceof Error) {
-                    throw (Error) t;
-                } else if (t instanceof RuntimeException) {
-                    throw (RuntimeException) t;
-                } else {
-                    throw new IllegalStateException("Unexpected exception type", t);
-                }
-            }
-        }
-    }
-
-    public static BufferedImage capture(Robot rob, ComponentOperator operator) {
-        Rectangle boundary = new Rectangle(operator.getLocationOnScreen(),
-                operator.getSize());
-        return rob.createScreenCapture(boundary);
-    }
-
-    /**
-     * Wraps the test code so that in case of any failure as much information as
-     * possible is captured
-     *
-     * @param r test code Runnable
-     * @throws Exception whatever exception the test may throw
-     */
-    public static void captureDebugInfoOnFail(RunnableWithException r) throws Exception {
-        // TODO: Remove this once https://bugs.openjdk.java.net/browse/JDK-8151671 is fixed
-        try {
-            r.run();
-            System.out.println("TEST PASSED");
-        } catch (Throwable t) {
-            captureAll();
-            throw t;
-        }
-    }
-
-    /**
-     * This is a helper class which allows to catch throwables thrown in other
-     * threads and throw them in the main test thread
-     */
-    public static class MultiThreadedTryCatch {
-
-        private final List<Throwable> throwables
-                = Collections.synchronizedList(new ArrayList<>());
-
-        /**
-         * Throws registered throwables. If the list of the registered
-         * throwables is not empty, it re-throws the first throwable in the list
-         * adding all others into its suppressed list. Can be used in any
-         * thread.
-         *
-         * @throws Exception
-         */
-        public void throwRegistered() throws Exception {
-            Throwable root = null;
-            synchronized (throwables) {
-                if (!throwables.isEmpty()) {
-                    root = throwables.remove(0);
-                    while (!throwables.isEmpty()) {
-                        root.addSuppressed(throwables.remove(0));
-                    }
-                }
-            }
-            if (root != null) {
-                if (root instanceof Error) {
-                    throw (Error) root;
-                } else if (root instanceof Exception) {
-                    throw (Exception) root;
-                } else {
-                    throw new AssertionError("Unexpected exception type: " + root.getClass() + " (" + root + ")");
-                }
-            }
-        }
-
-        /**
-         * Registers a throwable and adds it to the list of throwables. Can be
-         * used in any thread.
-         *
-         * @param t
-         */
-        public void register(Throwable t) {
-            t.printStackTrace();
-            throwables.add(t);
-        }
-
-        /**
-         * Registers a throwable and adds it as the first item of the list of
-         * catched throwables.
-         *
-         * @param t
-         */
-        public void registerRoot(Throwable t) {
-            t.printStackTrace();
-            throwables.add(0, t);
-        }
-    }
-
-    /**
-     * Trying to capture as much information as possible. Currently it includes
-     * full dump and a screenshot of the whole screen.
-     */
-    public static void captureAll() {
-        PNGEncoder.captureScreen("failure.png", PNGEncoder.COLOR_MODE);
-        try {
-            Dumper.dumpAll("dumpAll.xml");
-        } catch (FileNotFoundException ex) {
-            Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, null, ex);
-        }
-        captureWindows();
-    }
-
-    /**
-     * Captures each showing window image using Window.paint() method.
-     */
-    private static void captureWindows() {
-        try {
-            EventQueue.invokeAndWait(() -> {
-                Window[] windows = Window.getWindows();
-                int index = 0;
-                for (Window w : windows) {
-                    if (!w.isShowing()) {
-                        continue;
-                    }
-                    BufferedImage img = new BufferedImage(w.getWidth(), w.getHeight(), BufferedImage.TYPE_INT_ARGB);
-                    Graphics g = img.getGraphics();
-                    w.paint(g);
-                    g.dispose();
-
-                    try {
-                        ImageIO.write(img, "png", new File("window" + index++ + ".png"));
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-            });
-        } catch (InterruptedException | InvocationTargetException ex) {
-            Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, null, ex);
-        }
-    }
-
-    public static interface RunnableWithException {
-
-        public void run() throws Exception;
-    }
-
-    public static void waitIsFocused(JFrameOperator jfo) {
-        jfo.waitState(new ComponentChooser() {
-
-            @Override
-            public boolean checkComponent(Component comp) {
-                return jfo.isFocused();
-            }
-
-            @Override
-            public String getDescription() {
-                return "JFrame is focused";
-            }
-        });
-    }
-
-    public static int getJWindowCount() {
-        return new QueueTool().invokeAndWait(new QueueTool.QueueAction<Integer>(null) {
-
-            @Override
-            public Integer launch() throws Exception {
-                Window[] windows = Window.getWindows();
-                int windowCount = 0;
-                for (Window w : windows) {
-                    if (w.getClass().equals(JWindow.class)) {
-                        windowCount++;
-                    }
-                }
-                return windowCount;
-            }
-        });
-    }
-
-    public static JWindow getJWindow() {
-        return getJWindow(0);
-    }
-
-    public static JWindow getJWindow(int index) {
-        return new QueueTool().invokeAndWait(new QueueTool.QueueAction<JWindow>(null) {
-
-            @Override
-            public JWindow launch() throws Exception {
-                Window[] windows = Window.getWindows();
-                int windowIndex = 0;
-                for (Window w : windows) {
-                    if (w.getClass().equals(JWindow.class)) {
-                        if (windowIndex == index) {
-                            return (JWindow) w;
-                        }
-                        windowIndex++;
-                    }
-                }
-                return null;
-            }
-        });
-    }
-
-    public static boolean isIconified(FrameOperator frameOperator) {
-        return frameOperator.getQueueTool().invokeAndWait(new QueueTool.QueueAction<Boolean>("Frame is iconified") {
-
-            @Override
-            public Boolean launch() throws Exception {
-                return (((Frame) frameOperator.getSource()).getState() & Frame.ICONIFIED) != 0;
-            }
-        });
-    }
-
-    public static final Operator.DefaultStringComparator EXACT_STRING_COMPARATOR
-            = new Operator.DefaultStringComparator(true, true);
-
-    /**
-     * Finds a label with the exact labelText and returns the operator for its
-     * parent container.
-     *
-     * @param container
-     * @param labelText
-     * @return
-     */
-    public static ContainerOperator<?> getLabeledContainerOperator(ContainerOperator<?> container, String labelText) {
-
-        container.setComparator(EXACT_STRING_COMPARATOR);
-
-        JLabelOperator jLabelOperator = new JLabelOperator(container, labelText);
-
-        assert labelText.equals(jLabelOperator.getText());
-
-        return new ContainerOperator<>(jLabelOperator.getParent());
-    }
-
-    /**
-     * Finds a JPanel with exact title text.
-     *
-     * @param container
-     * @param titleText
-     * @return
-     */
-    public static ContainerOperator<?> getBorderTitledJPanelOperator(ContainerOperator<?> container, String titleText) {
-        return new ContainerOperator<>(container, new JPanelByBorderTitleFinder(titleText, EXACT_STRING_COMPARATOR));
-    }
-
-    public static final QueueTool QUEUE_TOOL = new QueueTool();
-
-    /**
-     * Allows to find JPanel by the title text in its border.
-     */
-    public static class JPanelByBorderTitleFinder implements ComponentChooser {
-
-        String titleText;
-        Operator.StringComparator comparator;
-
-        /**
-         * @param titleText title text pattern
-         * @param comparator specifies string comparison algorithm.
-         */
-        public JPanelByBorderTitleFinder(String titleText, Operator.StringComparator comparator) {
-            this.titleText = titleText;
-            this.comparator = comparator;
-        }
-
-        /**
-         * @param titleText title text pattern
-         */
-        public JPanelByBorderTitleFinder(String titleText) {
-            this(titleText, Operator.getDefaultStringComparator());
-        }
-
-        @Override
-        public boolean checkComponent(Component comp) {
-            assert EventQueue.isDispatchThread();
-            if (comp instanceof JPanel) {
-                return checkBorder(((JPanel) comp).getBorder());
-            }
-            return false;
-        }
-
-        public boolean checkBorder(Border border) {
-            if (border instanceof TitledBorder) {
-                String title = ((TitledBorder) border).getTitle();
-                return comparator.equals(title, titleText);
-            } else if (border instanceof CompoundBorder) {
-                CompoundBorder compoundBorder = (CompoundBorder) border;
-                return checkBorder(compoundBorder.getInsideBorder()) || checkBorder(compoundBorder.getOutsideBorder());
-            } else {
-                return false;
-            }
-        }
-
-        @Override
-        public String getDescription() {
-            return ("JPanel with border title text \"" + titleText + "\" with comparator " + comparator);
-        }
-    }
-
-    public static class ByClassSimpleNameChooser implements ComponentChooser {
-
-        private final String className;
-
-        public ByClassSimpleNameChooser(String className) {
-            this.className = className;
-        }
-
-        @Override
-        public boolean checkComponent(Component comp) {
-            return comp.getClass().getSimpleName().equals(className);
-        }
-
-        @Override
-        public String getDescription() {
-            return "Component with the simple class name of " + className;
-        }
-
-    }
-
-    public static class ByClassChooser implements ComponentChooser {
-
-        private final Class<?> clazz;
-
-        public ByClassChooser(Class<?> clazz) {
-            this.clazz = clazz;
-        }
-
-        @Override
-        public boolean checkComponent(Component comp) {
-            return comp.getClass().equals(clazz);
-        }
-
-        @Override
-        public String getDescription() {
-            return "Component with the class of " + clazz;
-        }
-
-    }
-
-    public static class ByToolTipChooser implements ComponentChooser {
-
-        private final String tooltip;
-
-        public ByToolTipChooser(String tooltip) {
-            if (tooltip == null) {
-                throw new NullPointerException("Tooltip cannot be null");
-            }
-            this.tooltip = tooltip;
-        }
-
-        @Override
-        public boolean checkComponent(Component comp) {
-            return (comp instanceof JComponent)
-                    ? tooltip.equals(((JComponent) comp).getToolTipText())
-                    : false;
-        }
-
-        @Override
-        public String getDescription() {
-            return "JComponent with the tooltip '" + tooltip + "'";
-        }
-
-    }
-
-    @SuppressWarnings(value = "unchecked")
-    public static <R, O extends Operator, S extends Component> R getUIValue(O operator, Function<S, R> getter) {
-        return operator.getQueueTool().invokeSmoothly(new QueueTool.QueueAction<R>("getting UI value through the queue using " + getter) {
-
-            @Override
-            public R launch() throws Exception {
-                return getter.apply((S) operator.getSource());
-            }
-        });
-    }
-}
--- a/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/button/ButtonDemo.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/button/ButtonDemo.java	Fri Apr 29 11:54:18 2016 -0700
@@ -36,6 +36,7 @@
 
 import com.sun.swingset3.DemoProperties;
 import com.sun.swingset3.demos.JHyperlink;
+import java.lang.reflect.InvocationTargetException;
 
 /**
  *
@@ -210,10 +211,10 @@
         return panel;
     }
 
-    public static void main(String args[]) {
+    public static void main(String args[]) throws InterruptedException, InvocationTargetException {
         final ButtonDemo buttonDemo = new ButtonDemo();
 
-        javax.swing.SwingUtilities.invokeLater(() -> {
+        javax.swing.SwingUtilities.invokeAndWait(() -> {
             JFrame frame = new JFrame(DEMO_TITLE);
             frame.add(buttonDemo);
             frame.pack();
--- a/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/tabbedpane/TabbedPaneDemo.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/tabbedpane/TabbedPaneDemo.java	Fri Apr 29 11:54:18 2016 -0700
@@ -91,7 +91,6 @@
     public static void main(String[] args) {
         JFrame frame = new JFrame(DEMO_TITLE);
 
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.getContentPane().add(new TabbedPaneDemo());
         frame.setPreferredSize(new Dimension(800, 600));
         frame.pack();
@@ -205,7 +204,9 @@
         }
 
         public void go() {
-            animator = new javax.swing.Timer(22 + 22 + 22, this);
+            if (animator == null) {
+                animator = new javax.swing.Timer(22 + 22 + 22, this);
+            }
             animator.start();
         }
 
@@ -247,7 +248,7 @@
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (isVisible()) {
+            if (isShowing()) {
                 repaint();
             } else {
                 animator.stop();
--- a/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/window/WindowDemo.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/window/WindowDemo.java	Fri Apr 29 11:54:18 2016 -0700
@@ -31,6 +31,7 @@
 
 import com.sun.swingset3.DemoProperties;
 import com.sun.swingset3.demos.DemoUtilities;
+import java.lang.reflect.InvocationTargetException;
 
 /**
  * @author aim
@@ -145,8 +146,8 @@
         }
     }
 
-    public static void main(String args[]) {
-        EventQueue.invokeLater(() -> {
+    public static void main(String args[]) throws InterruptedException, InvocationTargetException {
+        EventQueue.invokeAndWait(() -> {
             JFrame frame = new JFrame();
             WindowDemo demo = new WindowDemo();
             frame.add(demo);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/rmi/TEST.properties	Fri Apr 29 11:54:18 2016 -0700
@@ -0,0 +1,1 @@
+modules = java.rmi
--- a/jdk/test/sun/util/logging/PlatformLoggerTest.java	Fri Apr 29 11:14:56 2016 -0700
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java	Fri Apr 29 11:54:18 2016 -0700
@@ -197,7 +197,7 @@
         // create a brand new java logger
         Logger javaLogger = sun.util.logging.internal.LoggingProviderImpl.getLogManagerAccess()
                      .demandLoggerFor(LogManager.getLogManager(),
-                          logger.getName()+"."+level.getName(), Thread.class);
+                          logger.getName()+"."+level.getName(), Thread.class.getModule());
 
         // Set a non standard java.util.logging.Level on the java logger
         // (except for OFF & ALL - which will remain unchanged)