< prev index next >
src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java
Print this page
rev 48495 : 8189102: All tools should support -?, -h and --help
Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini
*** 1,7 ****
/*
! * 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
--- 1,7 ----
/*
! * Copyright (c) 2004, 2018, 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
*** 45,55 ****
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 {
--- 45,56 ----
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]\n" +
! " jstatd -?|-h|--help");
}
static void bind(String name, RemoteHostImpl remoteHost)
throws RemoteException, MalformedURLException, Exception {
*** 76,86 ****
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 {
--- 77,92 ----
int argc = 0;
for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
String arg = args[argc];
! if (arg.compareTo("-?") == 0 ||
! arg.compareTo("-h") == 0 ||
! arg.compareTo("--help") == 0) {
! printUsage();
! System.exit(0);
! } else if (arg.compareTo("-nr") == 0) {
startRegistry = false;
} else if (arg.startsWith("-p")) {
if (arg.compareTo("-p") != 0) {
port = Integer.parseInt(arg.substring(2));
} else {
< prev index next >