diff --git a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
index 9fd609f5fb0..036388395fc 100644
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
@@ -70,7 +70,7 @@ endef
# Filter com.sun.jdi.connect.Connector
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
$(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
- $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+ $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/META-INF/services/com.sun.jdi.connect.Connector
$(process-provider)
# Copy the same service file into jdk.hotspot.agent so that they are kept the same.
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index ace022c0d87..926ebc7ce38 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -25,6 +25,10 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/CoreLibraries.gmk))
+
+
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
@@ -119,6 +123,9 @@ LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
+# Make it possible to override this variable
+LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
@@ -146,7 +153,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
- MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
+ MAPFILE := $(LIBJAVA_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index 68bdcc0a414..c716b48d430 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -27,6 +27,11 @@ include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/LibCommon.gmk))
+
+################################################################################
+
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
@@ -56,7 +61,7 @@ endif
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
-FindSrcDirsForLib = \
+FindSrcDirsForLib += \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
index 88fe8fe9fa1..b79e3385a7f 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,23 +29,20 @@ package java.lang.ref;
/**
* Phantom reference objects, which are enqueued after the collector
* determines that their referents may otherwise be reclaimed. Phantom
- * references are most often used for scheduling pre-mortem cleanup actions in
- * a more flexible way than is possible with the Java finalization mechanism.
+ * references are most often used to schedule post-mortem cleanup actions.
*
- *
If the garbage collector determines at a certain point in time that the
- * referent of a phantom reference is phantom reachable, then at that
- * time or at some later time it will enqueue the reference.
+ *
Suppose the garbage collector determines at a certain point in time
+ * that an object is
+ * phantom reachable. At that time it will atomically clear
+ * all phantom references to that object and all phantom references to
+ * any other phantom-reachable objects from which that object is reachable.
+ * At the same time or at some later time it will enqueue those newly-cleared
+ * phantom references that are registered with reference queues.
*
*
In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
*
- *
Unlike soft and weak references, phantom references are not
- * automatically cleared by the garbage collector as they are enqueued. An
- * object that is reachable via phantom references will remain so until all
- * such references are cleared or themselves become unreachable.
- *
* @author Mark Reinhold
* @since 1.2
*/
@@ -69,8 +66,8 @@ public class PhantomReference extends Reference {
*
*
It is possible to create a phantom reference with a {@code null}
* queue, but such a reference is completely useless: Its {@code get}
- * method will always return null and, since it does not have a queue, it
- * will never be enqueued.
+ * method will always return {@code null} and, since it does not have a queue,
+ * it will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java
index 32a58f36828..1ee769d16cc 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java
@@ -66,9 +66,9 @@
* object with a reference queue at the time the reference
* object is created. Some time after the garbage collector
* determines that the reachability of the referent has changed to the
- * value corresponding to the type of the reference, it will add the
- * reference to the associated queue. At this point, the reference is
- * considered to be enqueued. The program may remove
+ * value corresponding to the type of the reference, it will clear the
+ * reference and add it to the associated queue. At this point, the
+ * reference is considered to be enqueued. The program may remove
* references from a queue either by polling or by blocking until a
* reference becomes available. Reference queues are implemented by
* the {@link java.lang.ref.ReferenceQueue} class.
@@ -94,16 +94,6 @@
* structure, this check will add little overhead to the hashtable
* access methods.
*
- *
Automatically-cleared references
- *
- * Soft and weak references are automatically cleared by the collector
- * before being added to the queues with which they are registered, if
- * any. Therefore soft and weak references need not be registered
- * with a queue in order to be useful, while phantom references do.
- * An object that is reachable via phantom references will remain so
- * until all such references are cleared or themselves become
- * unreachable.
- *
*
*
Reachability
*
diff --git a/jdk/src/java.base/share/native/include/jvm.h b/jdk/src/java.base/share/native/include/jvm.h
index d99148a28cc..2f65c1a2e97 100644
--- a/jdk/src/java.base/share/native/include/jvm.h
+++ b/jdk/src/java.base/share/native/include/jvm.h
@@ -208,6 +208,9 @@ JVM_FillStackFrames(JNIEnv* env, jclass cls,
JNIEXPORT void JNICALL
JVM_SetMethodInfo(JNIEnv* env, jobject frame);
+JNIEXPORT jobjectArray JNICALL
+JVM_GetVmArguments(JNIEnv *env);
+
/*
* java.lang.Thread
*/
diff --git a/jdk/src/java.base/share/native/libjava/jni_util.c b/jdk/src/java.base/share/native/libjava/jni_util.c
index 7308b08b192..89f6edb7c03 100644
--- a/jdk/src/java.base/share/native/libjava/jni_util.c
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c
@@ -660,7 +660,8 @@ initializeEncoding(JNIEnv *env)
*/
if ((strcmp(encname, "8859_1") == 0) ||
(strcmp(encname, "ISO8859-1") == 0) ||
- (strcmp(encname, "ISO8859_1") == 0))
+ (strcmp(encname, "ISO8859_1") == 0) ||
+ (strcmp(encname, "ISO-8859-1") == 0))
fastEncoding = FAST_8859_1;
else if (strcmp(encname, "ISO646-US") == 0)
fastEncoding = FAST_646_US;
diff --git a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java
index 4291c5bcbf7..ff261f39235 100644
--- a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java
+++ b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -37,6 +37,7 @@ import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
@@ -142,7 +143,7 @@ class MLetParser {
skipSpace(in);
val = buf.toString();
}
- atts.put(att.toLowerCase(), val);
+ atts.put(att.toLowerCase(Locale.ENGLISH), val);
skipSpace(in);
}
return atts;
diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java
index f2534a62269..8499be40cc8 100644
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -45,6 +45,7 @@ import java.lang.reflect.Constructor;
import java.security.AccessController;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
@@ -283,7 +284,7 @@ public class DescriptorSupport
throw new RuntimeOperationsException(iae, msg);
}
- final String lowerInStr = inStr.toLowerCase();
+ final String lowerInStr = inStr.toLowerCase(Locale.ENGLISH);
if (!lowerInStr.startsWith("")
|| !lowerInStr.endsWith("")) {
throw new XMLParseException("No , pair");
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java
index 4f9c36e9509..bdac521bec3 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -38,6 +38,7 @@ import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.util.BitSet;
+import java.util.Locale;
import java.util.StringTokenizer;
/**
@@ -168,7 +169,7 @@ public class JMXServiceURL implements Serializable {
final int protoStart = requiredPrefixLength;
final int protoEnd = indexOf(serviceURL, ':', protoStart);
this.protocol =
- serviceURL.substring(protoStart, protoEnd).toLowerCase();
+ serviceURL.substring(protoStart, protoEnd).toLowerCase(Locale.ENGLISH);
if (!serviceURL.regionMatches(protoEnd, "://", 0, 3)) {
throw new MalformedURLException("Missing \"://\" after " +
@@ -328,7 +329,7 @@ public class JMXServiceURL implements Serializable {
throw new MalformedURLException("More than one [[...]]");
}
- this.protocol = protocol.toLowerCase();
+ this.protocol = protocol.toLowerCase(Locale.ENGLISH);
this.host = host;
this.port = port;
diff --git a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
index 06b26a0fe91..5ef0f7f1708 100644
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
@@ -30,9 +30,12 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
@@ -40,6 +43,7 @@ import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.RMISocketFactory;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
import java.security.KeyStore;
@@ -60,6 +64,8 @@ import javax.management.remote.JMXServiceURL;
import javax.management.remote.rmi.RMIConnectorServer;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
@@ -107,6 +113,8 @@ public final class ConnectorBootstrap {
public static final String PORT =
"com.sun.management.jmxremote.port";
+ public static final String HOST =
+ "com.sun.management.jmxremote.host";
public static final String RMI_PORT =
"com.sun.management.jmxremote.rmi.port";
public static final String CONFIG_FILE_NAME =
@@ -424,10 +432,14 @@ public final class ConnectorBootstrap {
checkAccessFile(accessFileName);
}
+ final String bindAddress =
+ props.getProperty(PropertyNames.HOST);
+
if (log.debugOn()) {
log.debug("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.starting") +
"\n\t" + PropertyNames.PORT + "=" + port +
+ (bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
"\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
"\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
"\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
@@ -458,7 +470,7 @@ public final class ConnectorBootstrap {
sslConfigFileName, enabledCipherSuitesList,
enabledProtocolsList, sslNeedClientAuth,
useAuthentication, loginConfigName,
- passwordFileName, accessFileName);
+ passwordFileName, accessFileName, bindAddress);
cs = data.jmxConnectorServer;
url = data.jmxRemoteURL;
log.config("startRemoteConnectorServer",
@@ -628,12 +640,13 @@ public final class ConnectorBootstrap {
String sslConfigFileName,
String[] enabledCipherSuites,
String[] enabledProtocols,
- boolean sslNeedClientAuth) {
+ boolean sslNeedClientAuth,
+ String bindAddress) {
if (sslConfigFileName == null) {
- return new SslRMIServerSocketFactory(
+ return new HostAwareSslSocketFactory(
enabledCipherSuites,
enabledProtocols,
- sslNeedClientAuth);
+ sslNeedClientAuth, bindAddress);
} else {
checkRestrictedFile(sslConfigFileName);
try {
@@ -687,11 +700,11 @@ public final class ConnectorBootstrap {
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
- return new SslRMIServerSocketFactory(
+ return new HostAwareSslSocketFactory(
ctx,
enabledCipherSuites,
enabledProtocols,
- sslNeedClientAuth);
+ sslNeedClientAuth, bindAddress);
} catch (Exception e) {
throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
}
@@ -711,7 +724,8 @@ public final class ConnectorBootstrap {
boolean useAuthentication,
String loginConfigName,
String passwordFileName,
- String accessFileName)
+ String accessFileName,
+ String bindAddress)
throws IOException, MalformedURLException {
/* Make sure we use non-guessable RMI object IDs. Otherwise
@@ -719,7 +733,7 @@ public final class ConnectorBootstrap {
* IDs. */
System.setProperty("java.rmi.server.randomIDs", "true");
- JMXServiceURL url = new JMXServiceURL("rmi", null, rmiPort);
+ JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
Map env = new HashMap<>();
@@ -727,6 +741,8 @@ public final class ConnectorBootstrap {
env.put(RMIExporter.EXPORTER_ATTRIBUTE, exporter);
+ boolean useSocketFactory = bindAddress != null && !useSsl;
+
if (useAuthentication) {
if (loginConfigName != null) {
env.put("jmx.remote.x.login.config", loginConfigName);
@@ -751,7 +767,7 @@ public final class ConnectorBootstrap {
csf = new SslRMIClientSocketFactory();
ssf = createSslRMIServerSocketFactory(
sslConfigFileName, enabledCipherSuites,
- enabledProtocols, sslNeedClientAuth);
+ enabledProtocols, sslNeedClientAuth, bindAddress);
}
if (useSsl) {
@@ -761,6 +777,12 @@ public final class ConnectorBootstrap {
ssf);
}
+ if (useSocketFactory) {
+ ssf = new HostAwareSocketFactory(bindAddress);
+ env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+ ssf);
+ }
+
JMXConnectorServer connServer = null;
try {
connServer =
@@ -780,6 +802,10 @@ public final class ConnectorBootstrap {
registry =
new SingleEntryRegistry(port, csf, ssf,
"jmxrmi", exporter.firstExported);
+ } else if (useSocketFactory) {
+ registry =
+ new SingleEntryRegistry(port, csf, ssf,
+ "jmxrmi", exporter.firstExported);
} else {
registry =
new SingleEntryRegistry(port,
@@ -813,4 +839,172 @@ public final class ConnectorBootstrap {
private static final ClassLogger log =
new ClassLogger(ConnectorBootstrap.class.getPackage().getName(),
"ConnectorBootstrap");
+
+ private static class HostAwareSocketFactory implements RMIServerSocketFactory {
+
+ private final String bindAddress;
+
+ private HostAwareSocketFactory(String bindAddress) {
+ this.bindAddress = bindAddress;
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress == null) {
+ return new ServerSocket(port);
+ } else {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new ServerSocket(port, 0, addr);
+ } catch (UnknownHostException e) {
+ return new ServerSocket(port);
+ }
+ }
+ }
+ }
+
+ private static class HostAwareSslSocketFactory extends SslRMIServerSocketFactory {
+
+ private final String bindAddress;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private HostAwareSslSocketFactory(String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this(null, enabledCipherSuites, enabledProtocols, sslNeedClientAuth, bindAddress);
+ }
+
+ private HostAwareSslSocketFactory(SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this.context = ctx;
+ this.bindAddress = bindAddress;
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = sslNeedClientAuth;
+ checkValues(ctx, enabledCipherSuites, enabledProtocols);
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress != null) {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new SslServerSocket(port, 0, addr, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ } catch (UnknownHostException e) {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ } else {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ }
+
+ private static void checkValues(SSLContext context,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols) throws IllegalArgumentException {
+ // Force the initialization of the default at construction time,
+ // rather than delaying it to the first time createServerSocket()
+ // is called.
+ //
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ (SSLSocketFactory)SSLSocketFactory.getDefault() : context.getSocketFactory();
+ SSLSocket sslSocket = null;
+ if (enabledCipherSuites != null || enabledProtocols != null) {
+ try {
+ sslSocket = (SSLSocket) sslSocketFactory.createSocket();
+ } catch (Exception e) {
+ final String msg = "Unable to check if the cipher suites " +
+ "and protocols to enable are supported";
+ throw (IllegalArgumentException)
+ new IllegalArgumentException(msg).initCause(e);
+ }
+ }
+
+ // Check if all the cipher suites and protocol versions to enable
+ // are supported by the underlying SSL/TLS implementation and if
+ // true create lists from arrays.
+ //
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ }
+ }
+
+ private static class SslServerSocket extends ServerSocket {
+
+ private static SSLSocketFactory defaultSSLSocketFactory;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private SslServerSocket(int port,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ private SslServerSocket(int port,
+ int backlog,
+ InetAddress bindAddr,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port, backlog, bindAddr);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ @Override
+ public Socket accept() throws IOException {
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ getDefaultSSLSocketFactory() : context.getSocketFactory();
+ Socket socket = super.accept();
+ SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
+ socket, socket.getInetAddress().getHostName(),
+ socket.getPort(), true);
+ sslSocket.setUseClientMode(false);
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ sslSocket.setNeedClientAuth(needClientAuth);
+ return sslSocket;
+ }
+
+ private static synchronized SSLSocketFactory getDefaultSSLSocketFactory() {
+ if (defaultSSLSocketFactory == null) {
+ defaultSSLSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
+ return defaultSSLSocketFactory;
+ } else {
+ return defaultSSLSocketFactory;
+ }
+ }
+
+ }
}
diff --git a/jdk/src/java.management/share/conf/management.properties b/jdk/src/java.management/share/conf/management.properties
index 529fd3b099c..02401d78bec 100644
--- a/jdk/src/java.management/share/conf/management.properties
+++ b/jdk/src/java.management/share/conf/management.properties
@@ -316,3 +316,16 @@
# For a non-default password file location use the following line
# com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=
+# Specifies the local interface on which the JMX RMI agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
diff --git a/jdk/src/java.management/share/native/include/jmm.h b/jdk/src/java.management/share/native/include/jmm.h
index 1730541d076..6c3894ad8dc 100644
--- a/jdk/src/java.management/share/native/include/jmm.h
+++ b/jdk/src/java.management/share/native/include/jmm.h
@@ -227,16 +227,10 @@ typedef struct jmmInterface_1_ {
jint (JNICALL *GetOptionalSupport) (JNIEnv *env,
jmmOptionalSupport* support_ptr);
- /* This is used by JDK 6 and earlier.
- * For JDK 7 and after, use GetInputArgumentArray.
- */
- jobject (JNICALL *GetInputArguments) (JNIEnv *env);
-
jint (JNICALL *GetThreadInfo) (JNIEnv *env,
jlongArray ids,
jint maxDepth,
jobjectArray infoArray);
- jobjectArray (JNICALL *GetInputArgumentArray) (JNIEnv *env);
jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr);
diff --git a/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c
index 1aa09d2c41e..7743c359764 100644
--- a/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c
+++ b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c
@@ -112,7 +112,7 @@ JNIEXPORT jobjectArray JNICALL
Java_sun_management_VMManagementImpl_getVmArguments0
(JNIEnv *env, jobject dummy)
{
- return jmm_interface->GetInputArgumentArray(env);
+ return JVM_GetVmArguments(env);
}
JNIEXPORT jlong JNICALL
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java
index 93c10f0b00f..6f928785255 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -43,7 +43,7 @@ import java.util.*;
class EventRequestManagerImpl extends MirrorImpl
implements EventRequestManager
{
- List extends EventRequest>[] requestLists;
+ private final List extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0;
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
@@ -83,7 +83,7 @@ class EventRequestManagerImpl extends MirrorImpl
return System.identityHashCode(this);
}
- abstract class EventRequestImpl extends MirrorImpl implements EventRequest {
+ private abstract class EventRequestImpl extends MirrorImpl implements EventRequest {
int id;
/*
@@ -734,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl
}
requestLists = new List[highest+1];
for (int i=0; i <= highest; i++) {
- requestLists[i] = new ArrayList<>();
+ requestLists[i] = Collections.synchronizedList(new ArrayList<>());
}
}
@@ -933,22 +933,27 @@ class EventRequestManagerImpl extends MirrorImpl
}
List extends EventRequest> unmodifiableRequestList(int eventCmd) {
- return Collections.unmodifiableList(requestList(eventCmd));
+ // No need of explicit synchronization for requestList here.
+ // It is taken care internally by SynchronizedList class.
+ return Collections.unmodifiableList(new ArrayList<>(requestList(eventCmd)));
}
EventRequest request(int eventCmd, int requestId) {
List extends EventRequest> rl = requestList(eventCmd);
- for (int i = rl.size() - 1; i >= 0; i--) {
- EventRequestImpl er = (EventRequestImpl)rl.get(i);
- if (er.id == requestId) {
- return er;
+ synchronized(rl) { // Refer Collections.synchronizedList javadoc.
+ Iterator extends EventRequest> itr = rl.iterator();
+ while (itr.hasNext()){
+ EventRequestImpl er = (EventRequestImpl)itr.next();
+ if (er.id == requestId)
+ return er;
}
}
return null;
}
- List extends EventRequest> requestList(int eventCmd) {
+ private List extends EventRequest> requestList(int eventCmd) {
return requestLists[eventCmd];
}
}
+
diff --git a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
index f7bcb89e715..81baff826e4 100644
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
@@ -121,7 +121,8 @@ jdbFailIfNotPresent 'System\..*bottom of loop'
jdbFailIfNotPresent 'System\..*end of test'
# make sure we had at least one full GC
-debuggeeFailIfNotPresent 'Full GC'
+# Prior to JDK9-B95, the pattern was 'Full GC'
+debuggeeMatchRegexp '^.*?\bPause Full\b\(System.gc\(\)\)\b.*?$'
# check for error message due to thread ID change
debuggeeFailIfPresent \
diff --git a/jdk/test/java/lang/ref/PhantomReferentClearing.java b/jdk/test/java/lang/ref/PhantomReferentClearing.java
new file mode 100644
index 00000000000..7d126c7b23d
--- /dev/null
+++ b/jdk/test/java/lang/ref/PhantomReferentClearing.java
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ *
+ * 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 8071507
+ * @summary Test that PhantomReferences are cleared when notified.
+ * @run main/othervm PhantomReferentClearing
+ */
+
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PhantomReferentClearing {
+
+ private static final long ENQUEUE_TIMEOUT = 1000; // 1 sec, in millis
+
+ // P1 & P2 are PhantomReference objects
+ // O1 & O2 are objects
+ //
+ // -> is a strong reference
+ // => is a referent reference
+ //
+ // root -> P1
+ // root -> P2
+ // root -> O1
+ // root -> O2
+ // O1 -> O2
+ // P1 => O1
+ // P2 => O2
+ //
+ // (1) Remove root -> O1 and collect. P1 notified, P2 !notified.
+ // (2) Remove root -> O2 and collect.
+ //
+ // If phantom references are cleared when notified, as proposed by
+ // 8071507, then P2 should be notified, and the test passes.
+ //
+ // Otherwise, P2 does not get notified because it remains reachable
+ // from O1, which is being retained by P1. This fails the test.
+
+ private static final ReferenceQueue