/** * Find a unique VM id. Check existing 'real' VMs, as well as the last id used for a VMStandin. */ private String createUniqueId(IVMInstallType vmType) { String id = null; do { id = String.valueOf(System.currentTimeMillis()); } while (vmType.findVMInstall(id) != null || id.equals(fgLastUsedID)); fgLastUsedID = id; return id; }
public static String createVMId(IVMInstallType type) { // This code based on code copied from // org.eclipse.jdt.launching.JavaRuntime.detectEclipseRuntime() // Make sure the VM id is unique long unique = System.currentTimeMillis(); while (type.findVMInstall(String.valueOf(unique)) != null) { unique++; } return String.valueOf(unique); }