54 * Each ProcessHandle identifies and allows control of a process in the native
55 * system. ProcessHandles are returned from the factory methods {@link #current()},
56 * {@link #of(long)},
57 * {@link #children}, {@link #allChildren}, {@link #parent()} and
58 * {@link #allProcesses()}.
59 * <p>
60 * The {@link Process} instances created by {@link ProcessBuilder} can be queried
61 * for a ProcessHandle that provides information about the Process.
62 * ProcessHandle references should not be freely distributed.
63 *
64 * <p>
65 * A {@link java.util.concurrent.CompletableFuture} available from {@link #onExit}
66 * can be used to wait for process termination, and possibly trigger dependent
67 * actions.
68 * <p>
69 * The factory methods limit access to ProcessHandles using the
70 * SecurityManager checking the {@link RuntimePermission RuntimePermission("manageProcess")}.
71 * The ability to control processes is also restricted by the native system,
72 * ProcessHandle provides no more access to, or control over, the native process
73 * than would be allowed by a native application.
74 * <p>
75 * @implSpec
76 * In the case where ProcessHandles cannot be supported then the factory
77 * methods must consistently throw {@link java.lang.UnsupportedOperationException}.
78 * The methods of this class throw {@link java.lang.UnsupportedOperationException}
79 * if the operating system does not allow access to query or kill a process.
80 *
81 * @see Process
82 * @since 1.9
83 */
84 public interface ProcessHandle extends Comparable<ProcessHandle> {
85
86 /**
87 * Returns the native process ID of the process. The native process ID is an
88 * identification number that the operating system assigns to the process.
89 *
90 * @return the native process ID of the process
91 * @throws UnsupportedOperationException if the implementation
92 * does not support this operation
93 */
94 long getPid();
|
54 * Each ProcessHandle identifies and allows control of a process in the native
55 * system. ProcessHandles are returned from the factory methods {@link #current()},
56 * {@link #of(long)},
57 * {@link #children}, {@link #allChildren}, {@link #parent()} and
58 * {@link #allProcesses()}.
59 * <p>
60 * The {@link Process} instances created by {@link ProcessBuilder} can be queried
61 * for a ProcessHandle that provides information about the Process.
62 * ProcessHandle references should not be freely distributed.
63 *
64 * <p>
65 * A {@link java.util.concurrent.CompletableFuture} available from {@link #onExit}
66 * can be used to wait for process termination, and possibly trigger dependent
67 * actions.
68 * <p>
69 * The factory methods limit access to ProcessHandles using the
70 * SecurityManager checking the {@link RuntimePermission RuntimePermission("manageProcess")}.
71 * The ability to control processes is also restricted by the native system,
72 * ProcessHandle provides no more access to, or control over, the native process
73 * than would be allowed by a native application.
74 *
75 * @implSpec
76 * In the case where ProcessHandles cannot be supported then the factory
77 * methods must consistently throw {@link java.lang.UnsupportedOperationException}.
78 * The methods of this class throw {@link java.lang.UnsupportedOperationException}
79 * if the operating system does not allow access to query or kill a process.
80 *
81 * @see Process
82 * @since 1.9
83 */
84 public interface ProcessHandle extends Comparable<ProcessHandle> {
85
86 /**
87 * Returns the native process ID of the process. The native process ID is an
88 * identification number that the operating system assigns to the process.
89 *
90 * @return the native process ID of the process
91 * @throws UnsupportedOperationException if the implementation
92 * does not support this operation
93 */
94 long getPid();
|