Commit 68ac70e0 authored by Liang Ding's avatar Liang Ding

🎨 获取进程 id

parent 7939d17c
...@@ -54,7 +54,7 @@ import java.util.ResourceBundle; ...@@ -54,7 +54,7 @@ import java.util.ResourceBundle;
* Solo utilities. * Solo utilities.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.7.0.3, Mar 10, 2019 * @version 1.8.0.0, Mar 20, 2019
* @since 2.8.0 * @since 2.8.0
*/ */
public final class Solos { public final class Solos {
...@@ -139,6 +139,17 @@ public final class Solos { ...@@ -139,6 +139,17 @@ public final class Solos {
COOKIE_HTTP_ONLY = Boolean.valueOf(Latkes.getLocalProperty("cookieHttpOnly")); COOKIE_HTTP_ONLY = Boolean.valueOf(Latkes.getLocalProperty("cookieHttpOnly"));
} }
/**
* Gets the current process's id.
*
* @return the current process's id
*/
public static long currentPID() {
final String processName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
return Long.parseLong(processName.split("@")[0]);
}
/** /**
* Constructs a successful result. * Constructs a successful result.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment