src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java
changeset 48543 7067fe4e054e
parent 47216 71c04702a3d5
child 54277 f283f6871336
equal deleted inserted replaced
48542:19effb7970bc 48543:7067fe4e054e
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    45     private static Registry registry;
    45     private static Registry registry;
    46     private static int port = -1;
    46     private static int port = -1;
    47     private static boolean startRegistry = true;
    47     private static boolean startRegistry = true;
    48 
    48 
    49     private static void printUsage() {
    49     private static void printUsage() {
    50         System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]");
    50         System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]\n" +
       
    51                            "       jstatd -?|-h|--help");
    51     }
    52     }
    52 
    53 
    53     static void bind(String name, RemoteHostImpl remoteHost)
    54     static void bind(String name, RemoteHostImpl remoteHost)
    54                 throws RemoteException, MalformedURLException, Exception {
    55                 throws RemoteException, MalformedURLException, Exception {
    55 
    56 
    76         int argc = 0;
    77         int argc = 0;
    77 
    78 
    78         for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
    79         for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
    79             String arg = args[argc];
    80             String arg = args[argc];
    80 
    81 
    81             if (arg.compareTo("-nr") == 0) {
    82             if (arg.compareTo("-?") == 0 ||
       
    83                 arg.compareTo("-h") == 0 ||
       
    84                 arg.compareTo("--help") == 0) {
       
    85                 printUsage();
       
    86                 System.exit(0);
       
    87             } else if (arg.compareTo("-nr") == 0) {
    82                 startRegistry = false;
    88                 startRegistry = false;
    83             } else if (arg.startsWith("-p")) {
    89             } else if (arg.startsWith("-p")) {
    84                 if (arg.compareTo("-p") != 0) {
    90                 if (arg.compareTo("-p") != 0) {
    85                     port = Integer.parseInt(arg.substring(2));
    91                     port = Integer.parseInt(arg.substring(2));
    86                 } else {
    92                 } else {