202 * information about the process, if the process is alive and the
203 * information is available.
204 *
205 * @return a snapshot of information about the process, always non-null
206 */
207 Info info();
208
209 /**
210 * Information snapshot about the process.
211 * The attributes of a process vary by operating system and are not available
212 * in all implementations. Information about processes is limited
213 * by the operating system privileges of the process making the request.
214 * The return types are {@code Optional<T>} allowing explicit tests
215 * and actions if the value is available.
216 * @since 1.9
217 */
218 public interface Info {
219 /**
220 * Returns the executable pathname of the process.
221 *
222 * @return an {@code Optional<String>} of the executable pathname
223 * of the process
224 */
225 public Optional<String> command();
226
227 /**
228 * Returns an array of Strings of the arguments of the process.
229 *
230 * @return an {@code Optional<String[]>} of the arguments of the process
231 */
232 public Optional<String[]> arguments();
233
234 /**
235 * Returns the start time of the process.
236 *
237 * @return an {@code Optional<Instant>} of the start time of the process
238 */
239 public Optional<Instant> startInstant();
240
241 /**
242 * Returns the total cputime accumulated of the process.
243 *
244 * @return an {@code Optional<Duration>} for the accumulated total cputime
245 */
246 public Optional<Duration> totalCpuDuration();
247
248 /**
|
202 * information about the process, if the process is alive and the
203 * information is available.
204 *
205 * @return a snapshot of information about the process, always non-null
206 */
207 Info info();
208
209 /**
210 * Information snapshot about the process.
211 * The attributes of a process vary by operating system and are not available
212 * in all implementations. Information about processes is limited
213 * by the operating system privileges of the process making the request.
214 * The return types are {@code Optional<T>} allowing explicit tests
215 * and actions if the value is available.
216 * @since 1.9
217 */
218 public interface Info {
219 /**
220 * Returns the executable pathname of the process.
221 *
222 * @implNote Note that the returned pathname may be truncated on some
223 * platforms due to system limitations. It may also only
224 * contain the name of the executable without the full path
225 * information.
226 *
227 * @return an {@code Optional<String>} of the executable pathname
228 * of the process
229 */
230 public Optional<String> command();
231
232 /**
233 * Returns an array of Strings of the arguments of the process.
234 *
235 * @implNote Note that the argument list may be truncated on some
236 * platforms due to system limitations.
237 *
238 * @return an {@code Optional<String[]>} of the arguments of the process
239 */
240 public Optional<String[]> arguments();
241
242 /**
243 * Returns the start time of the process.
244 *
245 * @return an {@code Optional<Instant>} of the start time of the process
246 */
247 public Optional<Instant> startInstant();
248
249 /**
250 * Returns the total cputime accumulated of the process.
251 *
252 * @return an {@code Optional<Duration>} for the accumulated total cputime
253 */
254 public Optional<Duration> totalCpuDuration();
255
256 /**
|