< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstack/JStack.java

Print this page
rev 16854 : [mq]: 8176533_fix_all

*** 82,103 **** params = new String[] { "-l" }; } else { params = new String[0]; } ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg); ! Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JStack.class); ! if (vids.isEmpty()) { System.err.println("Could not find any processes matching : '" + pidArg + "'"); System.exit(1); } ! for (VirtualMachineDescriptor vid : vids) { ! if (vids.size() > 1) { ! System.out.println("Pid:" + vid.id()); } ! runThreadDump(vid.id(), params); } } // Attach to pid and perform a thread dump private static void runThreadDump(String pid, String args[]) throws Exception { --- 82,103 ---- params = new String[] { "-l" }; } else { params = new String[0]; } ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg); ! Collection<String> pids = ap.getVirtualMachinePids(JStack.class); ! if (pids.isEmpty()) { System.err.println("Could not find any processes matching : '" + pidArg + "'"); System.exit(1); } ! for (String pid : pids) { ! if (pids.size() > 1) { ! System.out.println("Pid:" + pid); } ! runThreadDump(pid, params); } } // Attach to pid and perform a thread dump private static void runThreadDump(String pid, String args[]) throws Exception {
< prev index next >