On this page
Interface ProcessHandle.Info
- Enclosing interface:
-
ProcessHandle
public static interface ProcessHandle.Info
Optional<T>
allowing explicit tests and actions if the value is available.
- Since:
- 9
Method Summary
Modifier and Type | Method | Description |
---|---|---|
Optional |
arguments() |
Returns an array of Strings of the arguments of the process.
|
Optional |
command() |
Returns the executable pathname of the process.
|
Optional |
commandLine() |
Returns the command line of the process.
|
Optional |
startInstant() |
Returns the start time of the process.
|
Optional |
totalCpuDuration() |
Returns the total cputime accumulated of the process.
|
Optional |
user() |
Return the user of the process.
|
Method Details
command
Optional<String> command()
- Returns:
-
an
Optional<String>
of the executable pathname of the process
commandLine
Optional<String> commandLine()
If command()
and arguments()
return non-empty optionals, this is simply a convenience method which concatenates the values of the two functions separated by spaces. Otherwise it will return a best-effort, platform dependent representation of the command line.
- API Note:
-
Note that the returned executable pathname and the arguments may be truncated on some platforms due to system limitations.
The executable pathname may contain only the name of the executable without the full path information. It is undecidable whether white space separates different arguments or is part of a single argument.
- Returns:
-
an
Optional<String>
of the command line of the process
arguments
Optional<String[]> arguments()
- API Note:
- On some platforms, native applications are free to change the arguments array after startup and this method may only show the changed values.
- Returns:
-
an
Optional<String[]>
of the arguments of the process
startInstant
Optional<Instant> startInstant()
- Returns:
-
an
Optional<Instant>
of the start time of the process
totalCpuDuration
Optional<Duration> totalCpuDuration()
- Returns:
-
an
Optional<Duration>
for the accumulated total cputime
user
Optional<String> user()
- Returns:
-
an
Optional<String>
for the user of the process
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ProcessHandle.Info.html