< prev index next >
src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java
Print this page
rev 16854 : [mq]: 8176533_fix_all
@@ -28,10 +28,11 @@
import java.lang.reflect.Module;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.stream.Collectors;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import sun.jvmstat.monitor.MonitorException;
@@ -143,6 +144,19 @@
public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors() {
return this.getVirtualMachineDescriptors(null);
}
+ public Collection<String> getVirtualMachinePids(Class<?> excludeClass) {
+ if (singlePid != null) {
+ // There is a bug in AttachProvider, when VM is debugge-suspened it's not listed by the AttachProvider.
+ // If we are talking about a specific pid, just return it.
+ return List.of(singlePid);
+ } else {
+ return getVMDs(excludeClass, matchClass).stream().map(x -> {return x.id();}).collect(Collectors.toList());
+ }
+ }
+
+ public Collection<String> getVirtualMachinePids() {
+ return this.getVirtualMachinePids(null);
+ }
}
< prev index next >