jdk/src/jdk.jcmd/share/classes/sun/tools/jcmd/JCmd.java
changeset 44422 14ab3266fe62
parent 38956 cf2c4bfba78a
equal deleted inserted replaced
44339:fb097b1398d9 44422:14ab3266fe62
    78                 System.out.println(vmd.id() + " " + vmd.displayName());
    78                 System.out.println(vmd.id() + " " + vmd.displayName());
    79             }
    79             }
    80             System.exit(0);
    80             System.exit(0);
    81         }
    81         }
    82 
    82 
    83         Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JCmd.class);
    83         Collection<String> pids = ap.getVirtualMachinePids(JCmd.class);
    84 
    84 
    85         if (vids.isEmpty()) {
    85         if (pids.isEmpty()) {
    86             System.err.println("Could not find any processes matching : '"
    86             System.err.println("Could not find any processes matching : '"
    87                                + arg.getProcessString() + "'");
    87                                + arg.getProcessString() + "'");
    88             System.exit(1);
    88             System.exit(1);
    89         }
    89         }
    90 
    90 
    91         boolean success = true;
    91         boolean success = true;
    92         for (VirtualMachineDescriptor vid : vids) {
    92         for (String pid : pids) {
    93             System.out.println(vid.id() + ":");
    93             System.out.println(pid + ":");
    94             if (arg.isListCounters()) {
    94             if (arg.isListCounters()) {
    95                 listCounters(vid.id());
    95                 listCounters(pid);
    96             } else {
    96             } else {
    97                 try {
    97                 try {
    98                     executeCommandForPid(vid.id(), arg.getCommand());
    98                     executeCommandForPid(pid, arg.getCommand());
    99                 } catch(AttachOperationFailedException ex) {
    99                 } catch(AttachOperationFailedException ex) {
   100                     System.err.println(ex.getMessage());
   100                     System.err.println(ex.getMessage());
   101                     success = false;
   101                     success = false;
   102                 } catch(Exception ex) {
   102                 } catch(Exception ex) {
   103                     ex.printStackTrace();
   103                     ex.printStackTrace();