8173608: Separate JDK management agent from java.management module

Reviewed-by: dfuchs, dholmes, erikj
This commit is contained in:
Mandy Chung 2017-01-31 20:06:32 -08:00
parent b659f6d8f4
commit 7e2dd137c3
74 changed files with 274 additions and 218 deletions
jdk
make
src
test

@ -28,7 +28,7 @@ include CopyCommon.gmk
################################################################################
MGMT_CONF_DIR := $(CONF_DST_DIR)/management
MGMT_CONF_SRC := $(JDK_TOPDIR)/src/java.management/share/conf
MGMT_CONF_SRC := $(JDK_TOPDIR)/src/jdk.management.agent/share/conf
MGMT_SRC_FILES := $(wildcard $(MGMT_CONF_SRC)/*)
MGMT_TARGET_FILES := $(subst $(MGMT_CONF_SRC),$(MGMT_CONF_DIR),$(MGMT_SRC_FILES))

@ -25,15 +25,12 @@
include GensrcCommon.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, gensrc/Gensrc-java.management.gmk))
################################################################################
include GensrcProperties.gmk
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
SRC_DIRS := $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources, \
SRC_DIRS := $(JDK_TOPDIR)/src/jdk.management.agent/share/classes/jdk/internal/agent/resources, \
CLASS := ListResourceBundle, \
))

@ -30,8 +30,7 @@ $(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.management.gmk))
################################################################################
LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \
$(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement
LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement
LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
$(addprefix -I,$(LIBMANAGEMENT_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.management \

@ -0,0 +1,59 @@
#
# Copyright (c) 2017, 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
################################################################################
LIBMANAGEMENT_RMI_SRC += $(JDK_TOPDIR)/src/jdk.management.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement_rmi
LIBMANAGEMENT_RMI_CFLAGS := $(addprefix -I,$(LIBMANAGEMENT_RMI_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.management.agent \
$(LIBJAVA_HEADER_FLAGS) \
#
$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT_RMI, \
LIBRARY := management_rmi, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBMANAGEMENT_RMI_SRC), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_RMI_CFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement_rmi/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(JDKLIB_LIBS), \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib, \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=management_rmi.dll" \
-D "JDK_INTERNAL_NAME=management_rmi" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_rmi, \
))
$(BUILD_LIBMANAGEMENT_RMI): $(call FindLib, java.base, java)
TARGETS += $(BUILD_LIBMANAGEMENT_RMI)
################################################################################

@ -28,7 +28,6 @@
SUNWprivate_1.1 {
global:
Java_sun_management_ClassLoadingImpl_setVerboseClass;
Java_sun_management_FileSystemImpl_isAccessUserOnly0;
Java_sun_management_GarbageCollectorImpl_getCollectionCount;
Java_sun_management_GarbageCollectorImpl_getCollectionTime;
Java_sun_management_HotspotThread_getInternalThreadCount;

@ -0,0 +1,34 @@
#
# Copyright (c) 2017, 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.
#
# Define library interface.
SUNWprivate_1.1 {
global:
Java_jdk_internal_agent_FileSystemImpl_isAccessUserOnly0;
JNI_OnLoad;
local:
*;
};

@ -177,6 +177,7 @@ module java.base {
exports jdk.internal.perf to
java.desktop,
java.management,
jdk.management.agent,
jdk.jvmstat;
exports jdk.internal.ref to
java.desktop,
@ -197,6 +198,7 @@ module java.base {
jdk.jlink;
exports jdk.internal.vm to
java.management,
jdk.management.agent,
jdk.jvmstat;
exports sun.net to
jdk.incubator.httpclient;

@ -47,7 +47,6 @@ import javax.management.remote.JMXPrincipal;
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
import sun.management.jmxremote.ConnectorBootstrap;
/**
* This {@link LoginModule} performs file-based authentication.
@ -110,12 +109,14 @@ import sun.management.jmxremote.ConnectorBootstrap;
*/
public class FileLoginModule implements LoginModule {
private static final String PASSWORD_FILE_NAME = "jmxremote.password";
// Location of the default password file
private static final String DEFAULT_PASSWORD_FILE_NAME =
AccessController.doPrivileged(new GetPropertyAction("java.home")) +
File.separatorChar + "conf" +
File.separatorChar + "management" + File.separatorChar +
ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
PASSWORD_FILE_NAME;
// Key to retrieve the stored username
private static final String USERNAME_KEY =
@ -200,8 +201,7 @@ public class FileLoginModule implements LoginModule {
passwordFileDisplayName = passwordFile;
} catch (SecurityException e) {
hasJavaHomePermission = false;
passwordFileDisplayName =
ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
passwordFileDisplayName = PASSWORD_FILE_NAME;
}
}
}

@ -43,13 +43,19 @@ module java.management {
exports javax.management.remote;
exports javax.management.remote.rmi;
exports javax.management.timer;
exports sun.management to jdk.jconsole, jdk.management;
exports com.sun.jmx.remote.internal to jdk.management.agent;
exports com.sun.jmx.remote.security to jdk.management.agent;
exports sun.management to
jdk.jconsole,
jdk.management,
jdk.management.agent;
exports sun.management.counter to jdk.management.agent;
exports sun.management.counter.perf to jdk.management.agent;
exports sun.management.spi to jdk.management;
uses javax.management.remote.JMXConnectorProvider;
uses javax.management.remote.JMXConnectorServerProvider;
uses sun.management.spi.PlatformMBeanProvider;
uses sun.management.spi.AgentProvider;
provides javax.security.auth.spi.LoginModule
with com.sun.jmx.remote.security.FileLoginModule;

@ -1,110 +0,0 @@
# ----------------------------------------------------------------------
# Template for SNMP Access Control List File
#
# o Copy this template to snmp.acl
# o Set access control for SNMP support
# o Change the permission of snmp.acl to be read-only
# by the owner.
#
# See below for the location of snmp.acl file.
# ----------------------------------------------------------------------
############################################################
# SNMP Access Control List File
############################################################
#
# Default location of this file is $JRE/conf/management/snmp.acl.
# You can specify an alternate location by specifying a property in
# the management config file $JRE/conf/management/management.properties
# or by specifying a system property (See that file for details).
#
##############################################################
# File permissions of the snmp.acl file
##############################################################
#
# Since there are cleartext community strings stored in this file,
# this ACL file must be readable by ONLY the owner,
# otherwise the program will exit with an error.
#
##############################################################
# Format of the acl group
##############################################################
#
# communities: a list of SNMP community strings to which the
# access control applies separated by commas.
#
# access: either "read-only" or "read-write".
#
# managers: a list of hosts to be granted the access rights.
# Each can be expressed as any one of the following:
# - hostname: hubble
# - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
# fe80::a00:20ff:fe9b:ea82/64
# see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
#
# An example of two community groups for multiple hosts:
# acl = {
# {
# communities = public, private
# access = read-only
# managers = hubble, snowbell, nanak
# }
# {
# communities = jerry
# access = read-write
# managers = hubble, telescope
# }
# }
#
##############################################################
# Format of the trap group
##############################################################
#
# trap-community: a single SNMP community string that will be included
# in the traps sent to the hosts.
#
# hosts: a list of hosts to which the SNMP agent will send traps.
#
# An example of two trap community definitions for multiple hosts:
# trap = {
# {
# trap-community = public
# hosts = hubble, snowbell
# }
# {
# trap-community = private
# hosts = telescope
# }
# }
#
############################################################
#
# Update the community strings (public and private) below
# before copying this template file
#
# Common SNMP ACL Example
# ------------------------
#
# o Only localhost can connect, and access rights
# are limited to read-only
# o Traps are sent to localhost only
#
#
# acl = {
# {
# communities = public, private
# access = read-only
# managers = localhost
# }
# }
#
#
# trap = {
# {
# trap-community = public
# hosts = localhost
# }
# }

@ -39,12 +39,14 @@ module java.rmi {
// accessible to the security manager at initialization time
exports com.sun.rmi.rmid to java.base;
exports sun.rmi.registry to
java.management;
jdk.management.agent;
exports sun.rmi.server to
java.management,
jdk.management.agent,
jdk.jconsole;
exports sun.rmi.transport to
java.management,
jdk.management.agent,
jdk.jconsole;
uses java.rmi.server.RMIClassLoaderSpi;
}

@ -31,6 +31,7 @@ module jdk.jconsole {
requires jdk.attach;
requires jdk.jvmstat;
requires jdk.management;
requires jdk.management.agent;
exports com.sun.tools.jconsole;
uses com.sun.tools.jconsole.JConsolePlugin;
}

@ -29,13 +29,11 @@ import java.util.*;
import java.io.IOException;
import java.io.File;
// Sun specific
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import com.sun.tools.attach.AttachNotSupportedException;
// Sun private
import sun.management.ConnectorAddressLink;
import jdk.internal.agent.ConnectorAddressLink;
import sun.jvmstat.monitor.HostIdentifier;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management;
package jdk.internal.agent;
import java.io.BufferedInputStream;
import java.io.File;
@ -50,12 +50,12 @@ import java.util.function.Predicate;
import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXServiceURL;
import static sun.management.AgentConfigurationError.*;
import sun.management.jmxremote.ConnectorBootstrap;
import static jdk.internal.agent.AgentConfigurationError.*;
import jdk.internal.agent.spi.AgentProvider;
import jdk.internal.vm.VMSupport;
import sun.management.jdp.JdpController;
import sun.management.jdp.JdpException;
import jdk.internal.vm.VMSupport;
import sun.management.spi.AgentProvider;
import sun.management.jmxremote.ConnectorBootstrap;
/**
* This Agent is started by the VM when -Dcom.sun.management.snmp or
@ -563,8 +563,8 @@ public class Agent {
*/
AgentProvider provider = AccessController.doPrivileged(
(PrivilegedAction<AgentProvider>) () -> {
for(AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) {
if(aProvider.getName().equals(SNMP_AGENT_NAME))
for (AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) {
if (aProvider.getName().equals(SNMP_AGENT_NAME))
return aProvider;
}
return null;
@ -708,7 +708,7 @@ public class Agent {
private static void initResource() {
try {
messageRB =
ResourceBundle.getBundle("sun.management.resources.agent");
ResourceBundle.getBundle("jdk.internal.agent.resources.agent");
} catch (MissingResourceException e) {
throw new Error("Fatal: Resource for management agent is missing");
}

@ -23,7 +23,7 @@
* questions.
*/
package sun.management;
package jdk.internal.agent;
/**
* Configuration Error thrown by a management agent.

@ -23,7 +23,7 @@
* questions.
*/
package sun.management;
package jdk.internal.agent;
import java.io.IOException;
import java.nio.ByteBuffer;

@ -23,7 +23,7 @@
* questions.
*/
package sun.management;
package jdk.internal.agent;
import java.io.File;
import java.io.IOException;

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.spi;
package jdk.internal.agent.spi;
import java.util.Properties;

@ -0,0 +1,33 @@
/*
* Copyright (c) 2017, 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.management.agent {
requires java.management;
exports jdk.internal.agent to jdk.jconsole;
uses jdk.internal.agent.spi.AgentProvider;
}

@ -25,6 +25,8 @@
package sun.management.jmxremote;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@ -73,13 +75,12 @@ import javax.security.auth.Subject;
import com.sun.jmx.remote.internal.RMIExporter;
import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
import com.sun.jmx.remote.util.ClassLogger;
import sun.management.Agent;
import sun.management.AgentConfigurationError;
import static sun.management.AgentConfigurationError.*;
import sun.management.ConnectorAddressLink;
import sun.management.FileSystem;
import jdk.internal.agent.Agent;
import jdk.internal.agent.AgentConfigurationError;
import static jdk.internal.agent.AgentConfigurationError.*;
import jdk.internal.agent.ConnectorAddressLink;
import jdk.internal.agent.FileSystem;
import sun.rmi.server.UnicastRef;
import sun.rmi.server.UnicastServerRef;
import sun.rmi.server.UnicastServerRef2;
@ -435,8 +436,8 @@ public final class ConnectorBootstrap {
final String bindAddress =
props.getProperty(PropertyNames.HOST);
if (log.debugOn()) {
log.debug("startRemoteConnectorServer",
if (logger.isLoggable(Level.DEBUG)) {
logger.log(Level.DEBUG, "startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.starting") +
"\n\t" + PropertyNames.PORT + "=" + port +
(bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
@ -473,9 +474,9 @@ public final class ConnectorBootstrap {
passwordFileName, accessFileName, bindAddress);
cs = data.jmxConnectorServer;
url = data.jmxRemoteURL;
log.config("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.ready",
url.toString()));
config("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.ready",
url.toString()));
} catch (Exception e) {
throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
}
@ -493,7 +494,7 @@ public final class ConnectorBootstrap {
// Remote connector server started but unable to export remote
// connector address and associated configuration properties to
// the instrumentation buffer - non-fatal error.
log.debug("startRemoteConnectorServer", e);
config("startRemoteConnectorServer", e);
}
return cs;
}
@ -573,7 +574,7 @@ public final class ConnectorBootstrap {
if (!fs.isAccessUserOnly(file)) {
final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
passwordFileName);
log.config("startRemoteConnectorServer", msg);
config("startRemoteConnectorServer", msg);
throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
passwordFileName);
}
@ -616,7 +617,7 @@ public final class ConnectorBootstrap {
final String msg = Agent.getText(
"jmxremote.ConnectorBootstrap.file.readonly",
restrictedFileName);
log.config("startRemoteConnectorServer", msg);
config("startRemoteConnectorServer", msg);
throw new AgentConfigurationError(
FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
}
@ -842,9 +843,19 @@ public final class ConnectorBootstrap {
private ConnectorBootstrap() {
}
private static final ClassLogger log =
new ClassLogger(ConnectorBootstrap.class.getPackage().getName(),
"ConnectorBootstrap");
private static final Logger logger =
System.getLogger(ConnectorBootstrap.class.getPackageName());
private static void config(String func, String msg) {
logger.log(Level.DEBUG, msg);
}
private static void config(String func, Throwable t) {
logger.log(Level.DEBUG, "ConnectorBootstrap::" + func, t);
}
private static void config(String func, String msg, Throwable t) {
logger.log(Level.DEBUG, msg, t);
}
private static class HostAwareSocketFactory implements RMIServerSocketFactory {

@ -23,13 +23,13 @@
* questions.
*/
package sun.management;
package jdk.internal.agent;
import java.io.File;
import java.io.IOException;
/*
* Solaris/Linux implementation of sun.management.FileSystem
* Solaris/Linux implementation of jdk.internal.agent.FileSystem
*/
public class FileSystemImpl extends FileSystem {
@ -51,7 +51,7 @@ public class FileSystemImpl extends FileSystem {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("management");
System.loadLibrary("management_rmi");
return null;
}
});

@ -28,18 +28,32 @@
#include "jni.h"
#include "jni_util.h"
#include "sun_management_FileSystemImpl.h"
#include "jdk_internal_agent_FileSystemImpl.h"
#ifdef _ALLBSD_SOURCE
#define stat64 stat
#endif
/*
* Class: sun_management_FileSystemImpl
* JNI_OnLoad
*/
JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
{
JNIEnv* env;
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) {
return JNI_EVERSION; /* JNI version not supported */
}
return JNI_VERSION_9;
}
/*
* Class: jdk_internal_agent_FileSystemImpl
* Method: isAccessUserOnly0
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isAccessUserOnly0
JNIEXPORT jboolean JNICALL Java_jdk_internal_agent_FileSystemImpl_isAccessUserOnly0
(JNIEnv *env, jclass ignored, jstring str)
{
jboolean res = JNI_FALSE;

@ -23,7 +23,7 @@
* questions.
*/
package sun.management;
package jdk.internal.agent;
import java.io.File;
import java.io.IOException;
@ -59,7 +59,7 @@ public class FileSystemImpl extends FileSystem {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("management");
System.loadLibrary("management_rmi");
return null;
}
});

@ -29,7 +29,19 @@
#include "jni.h"
#include "jni_util.h"
#include "sun_management_FileSystemImpl.h"
#include "jdk_internal_agent_FileSystemImpl.h"
JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
{
JNIEnv* env;
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) {
return JNI_EVERSION; /* JNI version not supported */
}
return JNI_VERSION_9;
}
/*
* Access mask to represent any file access
@ -234,22 +246,22 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) {
/*
* Class: sun_management_FileSystemImpl
* Class: jdk_internal_agent_FileSystemImpl
* Method: init0
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_management_FileSystemImpl_init0
JNIEXPORT void JNICALL Java_jdk_internal_agent_FileSystemImpl_init0
(JNIEnv *env, jclass ignored)
{
/* nothing to do */
}
/*
* Class: sun_management_FileSystemImpl
* Class: jdk_internal_agent_FileSystemImpl
* Method: isSecuritySupported0
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isSecuritySupported0
JNIEXPORT jboolean JNICALL Java_jdk_internal_agent_FileSystemImpl_isSecuritySupported0
(JNIEnv *env, jclass ignored, jstring str)
{
jboolean res;
@ -271,11 +283,11 @@ JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isSecuritySupporte
/*
* Class: sun_management_FileSystemImpl
* Class: jdk_internal_agent_FileSystemImpl
* Method: isAccessUserOnly0
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isAccessUserOnly0
JNIEXPORT jboolean JNICALL Java_jdk_internal_agent_FileSystemImpl_isAccessUserOnly0
(JNIEnv *env, jclass ignored, jstring str)
{
jboolean res = JNI_FALSE;

@ -41,7 +41,7 @@ import jdk.testlibrary.Utils;
* @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
* @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
* @modules java.management
* @modules jdk.management.agent
* jdk.attach
* jdk.jartool/sun.tools.jar
* @run build Application SimpleProvider jdk.testlibrary.*

@ -29,18 +29,18 @@
* @test
* @bug 7164191
* @summary properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
* @author Deven You
*/
import java.util.Properties;
import sun.management.Agent;
import jdk.internal.agent.Agent;
public class AgentCMETest {
static Class<?> agentClass;
/**
* In sun.management.Agent.loadManagementProperties(), call
* In jdk.internal.agent.Agent.loadManagementProperties(), call
* properties.putAll API may fail with ConcurrentModifcationException if the
* system properties are modified simultaneously by another thread
*

@ -25,11 +25,11 @@
* @test
* @bug 5013605
* @summary Localize log messages from the management agents
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
*
* @author Tim Bell
*/
import sun.management.Agent;
import jdk.internal.agent.Agent;
public class AgentCheckTest {

@ -31,7 +31,7 @@
* @test JdpDefaultsTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
* @library /lib/testlibrary
* @modules java.management/sun.management.jdp
* @modules jdk.management.agent/sun.management.jdp
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main JdpDefaultsTest
*/

@ -32,7 +32,7 @@
* @test JdpOffTest.java
* @summary Assert that no JDP packets are sent to the default address and port.
* @library /lib/testlibrary
* @modules java.management/sun.management.jdp
* @modules jdk.management.agent/sun.management.jdp
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
* @run main JdpOffTest
*/

@ -31,7 +31,7 @@
* @test JdpSpecificAddressTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
* @library /lib/testlibrary
* @modules java.management/sun.management.jdp
* @modules jdk.management.agent/sun.management.jdp
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main JdpSpecificAddressTest
*/

@ -28,7 +28,7 @@
*
* @author Daniel Fuchs
*
* @modules java.management/sun.management.jmxremote
* @modules jdk.management.agent/sun.management.jmxremote
* @run compile -XDignore.symbol.file=true -g LocalRMIServerSocketFactoryTest.java
* @run main LocalRMIServerSocketFactoryTest
*/

@ -41,8 +41,7 @@ import jdk.testlibrary.ProcessTools;
* @test
* @bug 6434402 8004926
* @library /lib/testlibrary
* @modules java.management/sun.management
* java.management
* @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.*
* @build TestManager TestApplication CustomLauncherTest
* @run main/othervm CustomLauncherTest
@ -147,7 +146,7 @@ public class CustomLauncherTest {
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
"-cp",
TEST_CLASSPATH,
"--add-exports", "java.management/sun.management=ALL-UNNAMED",
"--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
String.valueOf(serverPrc.getPid()),
port.get(),

@ -48,8 +48,8 @@ import jdk.testlibrary.ProcessTools;
* @summary Test JMX agent host address binding. Same ports but different
* interfaces to bind to (using plain sockets and SSL sockets).
*
* @modules java.management/sun.management
* java.management/sun.management.jmxremote
* @modules jdk.management.agent/jdk.internal.agent
* jdk.management.agent/sun.management.jmxremote
* @library /lib/testlibrary
* @build jdk.testlibrary.* JMXAgentInterfaceBinding
* @run main/timeout=5 JMXInterfaceBindingTest

@ -27,7 +27,7 @@
* @summary Tests that the jvmstat counters published by the out-of-the-box
* management agent for the JMX connection details are correct.
* @author Luis-Miguel Alventosa
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
* @run clean JvmstatCountersTest
* @run build JvmstatCountersTest
* @run main/othervm/timeout=600 -XX:+UsePerfData JvmstatCountersTest 1
@ -42,7 +42,7 @@ import java.util.*;
import javax.management.*;
import javax.management.remote.*;
import com.sun.tools.attach.*;
import sun.management.ConnectorAddressLink;
import jdk.internal.agent.ConnectorAddressLink;
public class JvmstatCountersTest {

@ -38,7 +38,7 @@ import jdk.testlibrary.Utils;
* without connection or username/password details.
* TestManager will attempt a connection to the address obtained from
* both agent properties and jvmstat buffer.
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* TestManager TestApplication
* @run main/othervm/timeout=300 LocalManagementTest
*/
@ -131,7 +131,7 @@ public class LocalManagementTest {
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
"-cp",
TEST_CLASSPATH,
"--add-exports", "java.management/sun.management=ALL-UNNAMED",
"--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
String.valueOf(serverPrc.getPid()),
port.get(),

@ -28,7 +28,7 @@ import java.io.IOException;
* @library /lib/testlibrary
* @bug 6557093
* @summary Check SSL config file permission for out-of-the-box management
* @modules java.management
* @modules jdk.management.agent
* @build jdk.testlibrary.* AbstractFilePermissionTest Dummy
* @run main/timeout=300 PasswordFilePermissionTest
*

@ -40,7 +40,7 @@ import java.util.Enumeration;
import javax.management.remote.*;
import javax.management.*;
import sun.management.AgentConfigurationError;
import jdk.internal.agent.AgentConfigurationError;
import java.security.Security;

@ -28,9 +28,8 @@
#
# @key intermittent
# @library /lib/testlibrary
# @modules java.management/sun.management
# java.management/sun.management.jmxremote
# java.management
# @modules jdk.management.agent/jdk.internal.agent
# jdk.management.agent/sun.management.jmxremote
# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiBootstrapTest.sh
@ -51,8 +50,8 @@ chmod -R 777 ${TESTCLASSES}/ssl
DEBUGOPTIONS=""
export DEBUGOPTIONS
EXTRAOPTIONS="--add-exports java.management/sun.management=ALL-UNNAMED \
--add-exports java.management/sun.management.jmxremote=ALL-UNNAMED"
EXTRAOPTIONS="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED \
--add-exports jdk.management.agent/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test

@ -42,7 +42,7 @@ import java.util.regex.Pattern;
* @library /lib/testlibrary
* @bug 6228231
* @summary Test that RMI registry uses SSL.
* @modules java.management
* @modules jdk.management.agent
* @build jdk.testlibrary.* RmiRegistrySslTestApp
* @run main/timeout=300 RmiRegistrySslTest
* @author Luis-Miguel Alventosa, Taras Ledkov

@ -27,8 +27,8 @@
# @summary Test RMI Bootstrap with SSL
#
# @library /lib/testlibrary
# @modules java.management/sun.management
# java.management/sun.management.jmxremote
# @modules jdk.management.agent/jdk.internal.agent
# jdk.management.agent/sun.management.jmxremote
# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiSslBootstrapTest.sh
@ -49,8 +49,8 @@ chmod -R 777 ${TESTCLASSES}/ssl
DEBUGOPTIONS=""
export DEBUGOPTIONS
EXTRAOPTIONS="--add-exports java.management/sun.management=ALL-UNNAMED \
--add-exports java.management/sun.management.jmxremote=ALL-UNNAMED"
EXTRAOPTIONS="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED \
--add-exports jdk.management.agent/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test

@ -43,7 +43,7 @@ import java.util.Enumeration;
import javax.management.remote.*;
import javax.management.*;
import sun.management.AgentConfigurationError;
import jdk.internal.agent.AgentConfigurationError;
/**
* <p>This class implements unit test for RMI Bootstrap.

@ -26,8 +26,8 @@
# @summary Test RMI Bootstrap with SSL and no keystore.
#
# @bug 4932854
# @modules java.management/sun.management
# java.management/sun.management.jmxremote
# @modules jdk.management.agent/jdk.internal.agent
# jdk.management.agent/sun.management.jmxremote
# @build TestLogger RmiSslNoKeyStoreTest
# @run shell/timeout=300 RmiSslNoKeyStoreTest.sh
@ -48,8 +48,8 @@ chmod -R 777 ${TESTCLASSES}/ssl
DEBUGOPTIONS=""
export DEBUGOPTIONS
EXTRAOPTIONS="--add-exports java.management/sun.management=ALL-UNNAMED \
--add-exports java.management/sun.management.jmxremote=ALL-UNNAMED"
EXTRAOPTIONS="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED \
--add-exports jdk.management.agent/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test

@ -27,7 +27,7 @@ import java.io.IOException;
* @test
* @library /lib/testlibrary
* @bug 6557093
* @modules java.management
* @modules jdk.management.agent
* @build jdk.testlibrary.* Dummy AbstractFilePermissionTest
* @summary Check SSL config file permission for out-of-the-box management
* @run main/timeout=300 SSLConfigFilePermissionTest

@ -46,7 +46,7 @@ import java.io.IOException;
import com.sun.tools.attach.VirtualMachine;
// Sun implementation specific
import sun.management.ConnectorAddressLink;
import jdk.internal.agent.ConnectorAddressLink;
public class TestManager {

@ -46,14 +46,15 @@ import javax.net.ssl.SSLHandshakeException;
import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.Utils;
import sun.management.Agent;
import sun.management.AgentConfigurationError;
import jdk.internal.agent.Agent;
import jdk.internal.agent.AgentConfigurationError;
import jdk.internal.agent.ConnectorAddressLink;
/**
* @test
* @bug 7110104
* @library /lib/testlibrary
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd
* @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
* @summary Makes sure that enabling/disabling the management agent through JCMD
@ -103,7 +104,7 @@ public class JMXStartStopTest {
String jmxUrlStr = null;
try {
jmxUrlStr = sun.management.ConnectorAddressLink.importFrom((int)pid);
jmxUrlStr = ConnectorAddressLink.importFrom((int)pid);
dbg_print("Local Service URL: " +jmxUrlStr);
if ( jmxUrlStr == null ) {
throw new Exception("No Service URL. Local agent not started?");

@ -42,7 +42,7 @@ import jdk.testlibrary.ProcessTools;
* in the related performance counters.
* @key intermittent
* @library /lib/testlibrary
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
*/

@ -38,7 +38,7 @@ import jdk.testlibrary.ProcessTools;
* Management agent may be disabled, started (only local connections) and started.
* The test asserts that the expected text is being printed.
* @library /lib/testlibrary
* @modules java.management/sun.management
* @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* JMXStatusTest JMXStatus1Test JMXStatus2Test
* @run testng/othervm -XX:+UsePerfData JMXStatus1Test

@ -30,8 +30,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import sun.management.Agent;
import sun.management.AgentConfigurationError;
import jdk.internal.agent.Agent;
import jdk.internal.agent.AgentConfigurationError;
import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.ProcessTools;