void () { if (isAttached()) { VirtualMachineProxyImpl virtualMachineProxy = getVirtualMachineProxy(); if (!virtualMachineProxy.canBeModified()) { closeProcess(false); return; } if (myIsTerminateTargetVM) { virtualMachineProxy.exit(-1); } else { // some VMs (like IBM VM 1.4.2 bundled with WebSphere) does not resume threads on dispose() like it should try { virtualMachineProxy.resume(); } finally { virtualMachineProxy.dispose(); } } } else { try { stopConnecting(); } finally { closeProcess(true); } } }