equal
deleted
inserted
replaced
82 params = new String[] { "-l" }; |
82 params = new String[] { "-l" }; |
83 } else { |
83 } else { |
84 params = new String[0]; |
84 params = new String[0]; |
85 } |
85 } |
86 ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg); |
86 ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg); |
87 Collection<VirtualMachineDescriptor> vids = ap.getVirtualMachineDescriptors(JStack.class); |
87 Collection<String> pids = ap.getVirtualMachinePids(JStack.class); |
88 |
88 |
89 if (vids.isEmpty()) { |
89 if (pids.isEmpty()) { |
90 System.err.println("Could not find any processes matching : '" + pidArg + "'"); |
90 System.err.println("Could not find any processes matching : '" + pidArg + "'"); |
91 System.exit(1); |
91 System.exit(1); |
92 } |
92 } |
93 |
93 |
94 for (VirtualMachineDescriptor vid : vids) { |
94 for (String pid : pids) { |
95 if (vids.size() > 1) { |
95 if (pids.size() > 1) { |
96 System.out.println("Pid:" + vid.id()); |
96 System.out.println("Pid:" + pid); |
97 } |
97 } |
98 runThreadDump(vid.id(), params); |
98 runThreadDump(pid, params); |
99 } |
99 } |
100 } |
100 } |
101 |
101 |
102 // Attach to pid and perform a thread dump |
102 // Attach to pid and perform a thread dump |
103 private static void runThreadDump(String pid, String args[]) throws Exception { |
103 private static void runThreadDump(String pid, String args[]) throws Exception { |