equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
221 } |
221 } |
222 |
222 |
223 /** |
223 /** |
224 * Returns a ProcessHandle for an existing native process. |
224 * Returns a ProcessHandle for an existing native process. |
225 * |
225 * |
226 * @param pid the native process identifier |
226 * @param pid the native process identifier |
227 * @return The ProcessHandle for the pid if the process is alive; |
227 * @return The ProcessHandle for the pid if the process is alive; |
228 * or {@code null} if the process ID does not exist in the native system. |
228 * or {@code null} if the process ID does not exist in the native system. |
229 * @throws SecurityException if RuntimePermission("manageProcess") is not granted |
229 * @throws SecurityException if RuntimePermission("manageProcess") is not granted |
230 */ |
230 */ |
231 static Optional<ProcessHandle> get(long pid) { |
231 static Optional<ProcessHandle> get(long pid) { |
232 SecurityManager sm = System.getSecurityManager(); |
232 SecurityManager sm = System.getSecurityManager(); |
233 if (sm != null) { |
233 if (sm != null) { |