1
1
/*
2
- * Copyright (c) 2014, 2024 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2014, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
89
89
* @see Process
90
90
* @since 9
91
91
*/
92
- @ jdk .internal .ValueBased
93
92
public interface ProcessHandle extends Comparable <ProcessHandle > {
94
93
95
94
/**
@@ -114,7 +113,7 @@ public interface ProcessHandle extends Comparable<ProcessHandle> {
114
113
* @throws UnsupportedOperationException if the implementation
115
114
* does not support this operation
116
115
*/
117
- public static Optional <ProcessHandle > of (long pid ) {
116
+ static Optional <ProcessHandle > of (long pid ) {
118
117
return ProcessHandleImpl .get (pid );
119
118
}
120
119
@@ -126,7 +125,7 @@ public static Optional<ProcessHandle> of(long pid) {
126
125
* @throws UnsupportedOperationException if the implementation
127
126
* does not support this operation
128
127
*/
129
- public static ProcessHandle current () {
128
+ static ProcessHandle current () {
130
129
return ProcessHandleImpl .current ();
131
130
}
132
131
@@ -204,21 +203,21 @@ static Stream<ProcessHandle> allProcesses() {
204
203
* and actions if the value is available.
205
204
* @since 9
206
205
*/
207
- public interface Info {
206
+ interface Info {
208
207
/**
209
208
* Returns the executable pathname of the process.
210
209
*
211
210
* @return an {@code Optional<String>} of the executable pathname
212
211
* of the process
213
212
*/
214
- public Optional <String > command ();
213
+ Optional <String > command ();
215
214
216
215
/**
217
216
* Returns the command line of the process.
218
217
* <p>
219
218
* If {@link #command command()} and {@link #arguments arguments()} return
220
219
* non-empty optionals, this is simply a convenience method which concatenates
221
- * the values of the two functions separated by spaces. Otherwise it will return a
220
+ * the values of the two functions separated by spaces. Otherwise, it will return a
222
221
* best-effort, platform dependent representation of the command line.
223
222
*
224
223
* @apiNote Note that the returned executable pathname and the
@@ -233,7 +232,7 @@ public interface Info {
233
232
* @return an {@code Optional<String>} of the command line
234
233
* of the process
235
234
*/
236
- public Optional <String > commandLine ();
235
+ Optional <String > commandLine ();
237
236
238
237
/**
239
238
* Returns an array of Strings of the arguments of the process.
@@ -244,28 +243,28 @@ public interface Info {
244
243
*
245
244
* @return an {@code Optional<String[]>} of the arguments of the process
246
245
*/
247
- public Optional <String []> arguments ();
246
+ Optional <String []> arguments ();
248
247
249
248
/**
250
249
* Returns the start time of the process.
251
250
*
252
251
* @return an {@code Optional<Instant>} of the start time of the process
253
252
*/
254
- public Optional <Instant > startInstant ();
253
+ Optional <Instant > startInstant ();
255
254
256
255
/**
257
256
* Returns the total cputime accumulated of the process.
258
257
*
259
258
* @return an {@code Optional<Duration>} for the accumulated total cputime
260
259
*/
261
- public Optional <Duration > totalCpuDuration ();
260
+ Optional <Duration > totalCpuDuration ();
262
261
263
262
/**
264
263
* Return the user of the process.
265
264
*
266
265
* @return an {@code Optional<String>} for the user of the process
267
266
*/
268
- public Optional <String > user ();
267
+ Optional <String > user ();
269
268
}
270
269
271
270
/**
@@ -285,13 +284,11 @@ public interface Info {
285
284
* {@link java.util.concurrent.CompletableFuture#isDone done} or to
286
285
* {@link java.util.concurrent.Future#get() wait} for it to terminate.
287
286
* {@link java.util.concurrent.Future#cancel(boolean) Cancelling}
288
- * the CompleteableFuture does not affect the Process.
287
+ * the {@linkplain CompletableFuture CompletableFuture} does not affect the Process.
289
288
* @apiNote
290
289
* The process may be observed to have terminated with {@link #isAlive}
291
- * before the ComputableFuture is completed and dependent actions are invoked.
292
- *
290
+ * before the {@code CompletableFuture} is completed and dependent actions are invoked.
293
291
* @return a new {@code CompletableFuture<ProcessHandle>} for the ProcessHandle
294
- *
295
292
* @throws IllegalStateException if the process is the current process
296
293
*/
297
294
CompletableFuture <ProcessHandle > onExit ();
0 commit comments