@Test public void testGetPid() { assertThat(UtilAll.getPid()).isGreaterThan(0); }
public static int getPid() { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String name = runtime.getName(); try { return Integer.parseInt(name.substring(0, name.indexOf('@'))); } catch (Exception e) { return -1; } }
UtilAll { public static int getPid() { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String name = runtime.getName(); try { return Integer.parseInt(name.substring(0, name.indexOf('@'))); } catch (Exception e) { return -1; } } }
UtilAll { public static int getPid() { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String name = runtime.getName(); try { return Integer.parseInt(name.substring(0, name.indexOf('@'))); } catch (Exception e) { return -1; } }  }
UtilAll { public static int getPid() { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String name = runtime.getName(); try { return Integer.parseInt(name.substring(0, name.indexOf('@'))); } catch (Exception e) { return -1; } }  static int getPid(); static void sleep(long sleepMs); static String currentStackTrace(); static String offset2FileName(final long offset); static long computeElapsedTimeMilliseconds(final long beginTime); static boolean isItTimeToDo(final String when); static String timeMillisToHumanString(); static String timeMillisToHumanString(final long t); static long computeNextMorningTimeMillis(); static long computeNextMinutesTimeMillis(); static long computeNextHourTimeMillis(); static long computeNextHalfHourTimeMillis(); static String timeMillisToHumanString2(final long t); static String timeMillisToHumanString3(final long t); static double getDiskPartitionSpaceUsedPercent(final String path); static int crc32(byte[] array); static int crc32(byte[] array, int offset, int length); static String bytes2string(byte[] src); static byte[] string2bytes(String hexString); static byte[] uncompress(final byte[] src); static byte[] compress(final byte[] src, final int level); static int asInt(String str, int defaultValue); static long asLong(String str, long defaultValue); static String formatDate(Date date, String pattern); static Date parseDate(String date, String pattern); static String responseCode2String(final int code); static String frontStringAtLeast(final String str, final int size); static boolean isBlank(String str); static String jstack(); static String jstack(Map<Thread, StackTraceElement[]> map); static boolean isInternalIP(byte[] ip); static boolean isInternalV6IP(InetAddress inetAddr); static String ipToIPv4Str(byte[] ip); static String ipToIPv6Str(byte[] ip); static byte[] getIP(); static void deleteFile(File file); static String list2String(List<String> list, String splitor); static List<String> string2List(String str, String splitor); }
UtilAll { public static int getPid() { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String name = runtime.getName(); try { return Integer.parseInt(name.substring(0, name.indexOf('@'))); } catch (Exception e) { return -1; } }  static int getPid(); static void sleep(long sleepMs); static String currentStackTrace(); static String offset2FileName(final long offset); static long computeElapsedTimeMilliseconds(final long beginTime); static boolean isItTimeToDo(final String when); static String timeMillisToHumanString(); static String timeMillisToHumanString(final long t); static long computeNextMorningTimeMillis(); static long computeNextMinutesTimeMillis(); static long computeNextHourTimeMillis(); static long computeNextHalfHourTimeMillis(); static String timeMillisToHumanString2(final long t); static String timeMillisToHumanString3(final long t); static double getDiskPartitionSpaceUsedPercent(final String path); static int crc32(byte[] array); static int crc32(byte[] array, int offset, int length); static String bytes2string(byte[] src); static byte[] string2bytes(String hexString); static byte[] uncompress(final byte[] src); static byte[] compress(final byte[] src, final int level); static int asInt(String str, int defaultValue); static long asLong(String str, long defaultValue); static String formatDate(Date date, String pattern); static Date parseDate(String date, String pattern); static String responseCode2String(final int code); static String frontStringAtLeast(final String str, final int size); static boolean isBlank(String str); static String jstack(); static String jstack(Map<Thread, StackTraceElement[]> map); static boolean isInternalIP(byte[] ip); static boolean isInternalV6IP(InetAddress inetAddr); static String ipToIPv4Str(byte[] ip); static String ipToIPv6Str(byte[] ip); static byte[] getIP(); static void deleteFile(File file); static String list2String(List<String> list, String splitor); static List<String> string2List(String str, String splitor); static final String YYYY_MM_DD_HH_MM_SS; static final String YYYY_MM_DD_HH_MM_SS_SSS; static final String YYYYMMDDHHMMSS; }