public class RuntimeUtil extends Object
| Constructor and Description |
|---|
RuntimeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addShutdownHook(Runnable runnable)
注册JVM关闭时的钩子程序
|
static String |
getCallerClass()
通过StackTrace,获得调用者的类名.
|
static String |
getCallerMethod()
通过StackTrace,获得调用者的"类名.方法名()"
获取StackTrace有消耗,不要滥用
|
static int |
getCores()
获取CPU核数
|
static String |
getCurrentClass()
通过StackTrace,获得当前方法的类名.
|
static String |
getCurrentMethod()
通过StackTrace,获得当前方法的"类名.方法名()"
获取StackTrace有消耗,不要滥用
|
static int |
getPid()
获得当前进程的PID
当失败时返回-1
|
static long |
getUpTime()
返回应用启动到现在的毫秒数
|
static String |
getVmArguments()
返回输入的JVM参数列表
|
public static int getPid()
public static long getUpTime()
public static String getVmArguments()
public static int getCores()
public static void addShutdownHook(Runnable runnable)
public static String getCallerClass()
public static String getCallerMethod()
public static String getCurrentClass()
public static String getCurrentMethod()
Copyright © 2018. All rights reserved.