src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java
changeset 58265 577e17cab93f
parent 53713 50c1b0a0f1e8
child 58506 dfe3d11378cc
equal deleted inserted replaced
58264:4e96939a5746 58265:577e17cab93f
    77         return excludeClass.getName();
    77         return excludeClass.getName();
    78     }
    78     }
    79 
    79 
    80     private static boolean check(VirtualMachineDescriptor vmd, String excludeClass, String partialMatch) {
    80     private static boolean check(VirtualMachineDescriptor vmd, String excludeClass, String partialMatch) {
    81 
    81 
    82         String mainClass = null;
    82         // Try to get the main class name using (platform specific) ProcessHelper
       
    83         String mainClass = ProcessHelper.getMainClass(vmd.id());
    83 
    84 
    84         // Get the main class name using platform specific helper
    85         // If the main class name could not be retrieved by ProcessHelper, get it with the attach mechanism
    85         ProcessHelper helper = ProcessHelper.platformProcessHelper();
       
    86         if (helper != null) {
       
    87             mainClass = helper.getMainClass(vmd.id());
       
    88         }
       
    89 
       
    90         // If the main class name is still unset then retrieve it with the attach mechanism
       
    91         if (mainClass == null) {
    86         if (mainClass == null) {
    92             try {
    87             try {
    93                 VmIdentifier vmId = new VmIdentifier(vmd.id());
    88                 VmIdentifier vmId = new VmIdentifier(vmd.id());
    94                 MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
    89                 MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
    95                 MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
    90                 MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);