jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java
changeset 44422 14ab3266fe62
parent 38956 cf2c4bfba78a
child 44545 83b611b88ac8
equal deleted inserted replaced
44339:fb097b1398d9 44422:14ab3266fe62
    28 import java.lang.reflect.Module;
    28 import java.lang.reflect.Module;
    29 import java.net.URISyntaxException;
    29 import java.net.URISyntaxException;
    30 import java.util.ArrayList;
    30 import java.util.ArrayList;
    31 import java.util.Collection;
    31 import java.util.Collection;
    32 import java.util.List;
    32 import java.util.List;
       
    33 import java.util.stream.Collectors;
    33 
    34 
    34 import com.sun.tools.attach.VirtualMachine;
    35 import com.sun.tools.attach.VirtualMachine;
    35 import com.sun.tools.attach.VirtualMachineDescriptor;
    36 import com.sun.tools.attach.VirtualMachineDescriptor;
    36 
    37 
    37 import sun.jvmstat.monitor.MonitorException;
    38 import sun.jvmstat.monitor.MonitorException;
   143 
   144 
   144     public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors() {
   145     public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors() {
   145         return this.getVirtualMachineDescriptors(null);
   146         return this.getVirtualMachineDescriptors(null);
   146     }
   147     }
   147 
   148 
       
   149     public Collection<String> getVirtualMachinePids(Class<?> excludeClass) {
       
   150         if (singlePid != null) {
       
   151             // There is a bug in AttachProvider, when VM is debuggee-suspended it's not listed by the AttachProvider.
       
   152             // If we are talking about a specific pid, just return it.
       
   153             return List.of(singlePid);
       
   154         } else {
       
   155             return getVMDs(excludeClass, matchClass).stream().map(x -> {return x.id();}).collect(Collectors.toList());
       
   156         }
       
   157     }
       
   158 
       
   159     public Collection<String> getVirtualMachinePids() {
       
   160         return this.getVirtualMachinePids(null);
       
   161     }
   148 }
   162 }