@Test public void getProcessID() throws Exception { assertNotNull(IOUtil.getApplicationId()); }
public static String getApplicationId() { if (null == applicationId) { synchronized (IOUtil.class) { if (null == applicationId) { StringBuilder sb = new StringBuilder(); String mainClassName = System.getProperty(MAIN_CLASS_PROPERTY_NAME); if (null == mainClassName) { mainClassName = "SniffyApplication"; } else { if (mainClassName.contains(" ")) { mainClassName = mainClassName.substring(0, mainClassName.indexOf(" ")); } if (mainClassName.contains("/")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("/")); } if (mainClassName.contains("\\")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("\\")); } } sb.append(mainClassName).append('.'); String workingDir = System.getProperty(WORKING_DIRECTORY_PROPERTY_NAME); String classPath = System.getProperty(JAVA_CLASS_PATH_PROPERTY_NAME); int hashCode = workingDir != null ? workingDir.hashCode() : 0; hashCode = 31 * hashCode + (classPath != null ? classPath.hashCode() : 0); sb.append(Integer.toString(hashCode)); applicationId = sb.toString(); } } } return applicationId; }
IOUtil { public static String getApplicationId() { if (null == applicationId) { synchronized (IOUtil.class) { if (null == applicationId) { StringBuilder sb = new StringBuilder(); String mainClassName = System.getProperty(MAIN_CLASS_PROPERTY_NAME); if (null == mainClassName) { mainClassName = "SniffyApplication"; } else { if (mainClassName.contains(" ")) { mainClassName = mainClassName.substring(0, mainClassName.indexOf(" ")); } if (mainClassName.contains("/")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("/")); } if (mainClassName.contains("\\")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("\\")); } } sb.append(mainClassName).append('.'); String workingDir = System.getProperty(WORKING_DIRECTORY_PROPERTY_NAME); String classPath = System.getProperty(JAVA_CLASS_PATH_PROPERTY_NAME); int hashCode = workingDir != null ? workingDir.hashCode() : 0; hashCode = 31 * hashCode + (classPath != null ? classPath.hashCode() : 0); sb.append(Integer.toString(hashCode)); applicationId = sb.toString(); } } } return applicationId; } }
IOUtil { public static String getApplicationId() { if (null == applicationId) { synchronized (IOUtil.class) { if (null == applicationId) { StringBuilder sb = new StringBuilder(); String mainClassName = System.getProperty(MAIN_CLASS_PROPERTY_NAME); if (null == mainClassName) { mainClassName = "SniffyApplication"; } else { if (mainClassName.contains(" ")) { mainClassName = mainClassName.substring(0, mainClassName.indexOf(" ")); } if (mainClassName.contains("/")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("/")); } if (mainClassName.contains("\\")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("\\")); } } sb.append(mainClassName).append('.'); String workingDir = System.getProperty(WORKING_DIRECTORY_PROPERTY_NAME); String classPath = System.getProperty(JAVA_CLASS_PATH_PROPERTY_NAME); int hashCode = workingDir != null ? workingDir.hashCode() : 0; hashCode = 31 * hashCode + (classPath != null ? classPath.hashCode() : 0); sb.append(Integer.toString(hashCode)); applicationId = sb.toString(); } } } return applicationId; }  }
IOUtil { public static String getApplicationId() { if (null == applicationId) { synchronized (IOUtil.class) { if (null == applicationId) { StringBuilder sb = new StringBuilder(); String mainClassName = System.getProperty(MAIN_CLASS_PROPERTY_NAME); if (null == mainClassName) { mainClassName = "SniffyApplication"; } else { if (mainClassName.contains(" ")) { mainClassName = mainClassName.substring(0, mainClassName.indexOf(" ")); } if (mainClassName.contains("/")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("/")); } if (mainClassName.contains("\\")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("\\")); } } sb.append(mainClassName).append('.'); String workingDir = System.getProperty(WORKING_DIRECTORY_PROPERTY_NAME); String classPath = System.getProperty(JAVA_CLASS_PATH_PROPERTY_NAME); int hashCode = workingDir != null ? workingDir.hashCode() : 0; hashCode = 31 * hashCode + (classPath != null ? classPath.hashCode() : 0); sb.append(Integer.toString(hashCode)); applicationId = sb.toString(); } } } return applicationId; }  static void closeSilently(Closeable closeable); static File getApplicationSniffyFolder(); static String getApplicationId(); }
IOUtil { public static String getApplicationId() { if (null == applicationId) { synchronized (IOUtil.class) { if (null == applicationId) { StringBuilder sb = new StringBuilder(); String mainClassName = System.getProperty(MAIN_CLASS_PROPERTY_NAME); if (null == mainClassName) { mainClassName = "SniffyApplication"; } else { if (mainClassName.contains(" ")) { mainClassName = mainClassName.substring(0, mainClassName.indexOf(" ")); } if (mainClassName.contains("/")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("/")); } if (mainClassName.contains("\\")) { mainClassName = mainClassName.substring(mainClassName.lastIndexOf("\\")); } } sb.append(mainClassName).append('.'); String workingDir = System.getProperty(WORKING_DIRECTORY_PROPERTY_NAME); String classPath = System.getProperty(JAVA_CLASS_PATH_PROPERTY_NAME); int hashCode = workingDir != null ? workingDir.hashCode() : 0; hashCode = 31 * hashCode + (classPath != null ? classPath.hashCode() : 0); sb.append(Integer.toString(hashCode)); applicationId = sb.toString(); } } } return applicationId; }  static void closeSilently(Closeable closeable); static File getApplicationSniffyFolder(); static String getApplicationId();  }