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 /**
|
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 the command line of the process.
229 * <p>
230 * If {@link #command command()} and {@link #arguments arguments()} return non-null
231 * optionals, this is simply a convenience method which concatenates
232 * the values of the two functions separated by spaces. Otherwise it will return a
233 * best-effort, platform dependent representation of the command line.
234 *
235 * @apiNote Note that the returned executable pathname and the
236 * arguments may be truncated on some platforms due to system
237 * limitations.
238 * <p>
239 * The executable pathname may contain only the
240 * name of the executable without the full path information.
241 * It is undecideable whether white space separates different
242 * arguments or is part of a single argument.
243 *
244 * @return an {@code Optional<String>} of the command line
245 * of the process
246 */
247 public Optional<String> commandLine();
248
249 /**
250 * Returns an array of Strings of the arguments of the process.
251 *
252 * @apiNote On some platforms, native applications are free to change
253 * the arguments array after startup and this method may only
254 * show the changed values.
255 *
256 * @return an {@code Optional<String[]>} of the arguments of the process
257 */
258 public Optional<String[]> arguments();
259
260 /**
261 * Returns the start time of the process.
262 *
263 * @return an {@code Optional<Instant>} of the start time of the process
264 */
265 public Optional<Instant> startInstant();
266
267 /**
268 * Returns the total cputime accumulated of the process.
269 *
270 * @return an {@code Optional<Duration>} for the accumulated total cputime
271 */
272 public Optional<Duration> totalCpuDuration();
273
274 /**
|