Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8263635: Add --servername option to jhsdb debugd #3669

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java
Original file line number Diff line number Diff line change
@@ -93,14 +93,19 @@ public static Remote lookup(String connectionString) throws DebuggerException {
Matcher matcher = CONNECT_PATTERN.matcher(connectionString);
matcher.find();

String rmiObjectName = matcher.group("servername") == null ? DEFAULT_RMI_OBJECT_NAME
: matcher.group("servername");
String serverNamePrefix = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix");
String rmiObjectName = matcher.group("servername");
if (serverNamePrefix != null) {
System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it in --connect.");
rmiObjectName = serverNamePrefix;
if (rmiObjectName == null) {
System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it in --connect.");
rmiObjectName = serverNamePrefix;
} else {
throw new DebuggerException("Cannot set both sun.jvm.hotspot.rmi.serverNamePrefix and servername in --connect together");
}
}
if (rmiObjectName == null) {
rmiObjectName = DEFAULT_RMI_OBJECT_NAME;
}

StringBuilder nameBuf = new StringBuilder("//");
nameBuf.append(matcher.group("host"));
nameBuf.append('/');
@@ -118,11 +123,18 @@ public static Remote lookup(String connectionString) throws DebuggerException {
}

private static String getName(String serverID, String serverName) {
String name = serverName == null ? DEFAULT_RMI_OBJECT_NAME : serverName;
String name = serverName;
String serverNamePrefix = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix");
if (serverNamePrefix != null) {
System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it in --servername.");
name = serverNamePrefix;
if (serverName == null) {
System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it with --servername.");
name = serverNamePrefix;
} else {
throw new DebuggerException("Cannot set both sun.jvm.hotspot.rmi.serverNamePrefix and in --servername together");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "in"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I fixed it in new commit.

}
}
if (name == null) {
name = DEFAULT_RMI_OBJECT_NAME;
}
if (serverID != null) {
name += "_" + serverID;
Original file line number Diff line number Diff line change
@@ -91,7 +91,8 @@ private static boolean commonHelp(String mode, boolean canConnectToRemote) {
}

private static boolean debugdHelp() {
System.out.println(" --serverid <id> A unique identifier for this debug server.");
System.out.println(" --serverid <id> A unique identifier for this debugd server.");
System.out.println(" --servername <name> Instance name of debugd server.");
System.out.println(" --rmiport <port> Sets the port number to which the RMI connector is bound." +
" If not specified a random available port is used.");
System.out.println(" --registryport <port> Sets the RMI registry port." +
@@ -102,7 +103,6 @@ private static boolean debugdHelp() {
" be a hostname or an IPv4/IPv6 address. This option overrides the system property" +
" 'java.rmi.server.hostname'. If not specified, the system property is used. If the system" +
" property is not set, a system hostname is used.");
System.out.println(" --servername <name> Instance name of debugd server.");
return commonHelp("debugd");
}

2 changes: 1 addition & 1 deletion src/jdk.hotspot.agent/share/man/jhsdb.1
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ If the system property is not set, a system hostname is used.
.B \f[CB]\-\-servername\f[R] \f[I]servername\f[R]
Sets the instance name of debugd server to distinguish SA debugee.
It is used for RMI object name for server instance.
If not specified, "SARemoteDebugger" will be set.
If not specified, "SARemoteDebugger" will be used.
.RS
.RE
.SH OPTIONS FOR THE JINFO MODE