Package io.smallrye.common.os
Class Process
- java.lang.Object
-
- io.smallrye.common.os.Process
-
public final class Process extends Object
Utilities for getting information about the current process.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<ProcessInfo>getAllProcesses()Returns all the running processes.static ProcessInfogetCurrentProcess()Returns information about the current processstatic longgetProcessId()Get the ID of this process.static StringgetProcessName()Get the name of this process.
-
-
-
Method Detail
-
getProcessName
public static String getProcessName()
Get the name of this process. If the process name is not known, then "<unknown>" is returned.- Returns:
- the process name (not
null)
-
getProcessId
public static long getProcessId()
Get the ID of this process. This is the operating system specific PID. If the PID cannot be determined, -1 is returned.- Returns:
- the ID of this process, or -1 if it cannot be determined
-
getCurrentProcess
public static ProcessInfo getCurrentProcess()
Returns information about the current process- Returns:
- the current process
-
getAllProcesses
public static List<ProcessInfo> getAllProcesses()
Returns all the running processes.- Returns:
- a list of all the running processes. May throw an exception if running on an unsupported JDK
- Throws:
UnsupportedOperationException- if running on JDK 8
-
-