Class ProcessInfo
java.lang.Object
org.springframework.boot.info.ProcessInfo
Information about the process of the application.
- Since:
- 3.3.0
- Author:
- Jonatan Ivanov, Andrey Litvitski
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMemory information.static classVirtual threads information. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCpus()Number of processors available to the process.Current time of the process.Locale of the process.Memory information for the process.@Nullable StringgetOwner()longlonggetPid()@Nullable InstantTime at which the process started.Timezone of the process.@Nullable DurationUptime of the process.@Nullable ProcessInfo.VirtualThreadsInfoVirtual threads information for the process.Working directory of the process.
-
Constructor Details
-
ProcessInfo
public ProcessInfo()
-
-
Method Details
-
getCpus
public int getCpus()Number of processors available to the process. This value may change between invocations especially in (containerized) environments where resource usage can be isolated (for example using control groups).- Returns:
- result of
Runtime.availableProcessors() - See Also:
-
getMemory
Memory information for the process. These values can provide details about the current memory usage and limits selected by the user or JVM ergonomics (init, max, committed, used for heap and non-heap). If limits not set explicitly, it might not be trivial to know what these values are runtime; especially in (containerized) environments where resource usage can be isolated (for example using control groups) or not necessarily trivial to discover. Other than that, these values can indicate if the JVM can resize the heap (stop-the-world).- Returns:
- heap and non-heap memory information
- Since:
- 3.4.0
- See Also:
-
getVirtualThreads
Virtual threads information for the process. These values provide details about the current state of virtual threads, including the number of mounted threads, queued threads, the parallelism level, and the thread pool size.- Returns:
- an instance of
ProcessInfo.VirtualThreadsInfocontaining information about virtual threads, ornullif the VirtualThreadSchedulerMXBean is not available - Since:
- 3.5.0
-
getPid
public long getPid() -
getParentPid
public long getParentPid() -
getOwner
-
getUptime
Uptime of the process. Can be useful to see how long the process has been running and to check how long ago the last deployment or restart happened.- Returns:
- duration since the process started, if available, otherwise
null - Since:
- 4.1.0
-
getStartTime
Time at which the process started. Can be useful to see when the process was started and to check when the last deployment or restart happened.- Returns:
- the time when the process started, if available, otherwise
null - Since:
- 4.1.0
- See Also:
-
getCurrentTime
Current time of the process. Can be useful to check if there is any clock-skew issue and if the current time that the process knows is accurate enough.- Returns:
- the current time of the process
- Since:
- 4.1.0
- See Also:
-
getTimezone
Timezone of the process. Can help to detect time and timezone related issues.- Returns:
- the timezone of the process
- Since:
- 4.1.0
- See Also:
-
getLocale
Locale of the process. Can help to detect issues connected to language and country settings.- Returns:
- the locale of the process
- Since:
- 4.1.0
- See Also:
-
getWorkingDirectory
Working directory of the process. Can help to locate files that the process uses.- Returns:
- the absolute path of the working directory of the process
- Since:
- 4.1.0
-