8178347: Process and ProcessHandle getPid method name inconsistency
Reviewed-by: alanb, bpb
--- a/jdk/src/java.base/share/classes/java/lang/Process.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -80,10 +80,10 @@
*
* <p>Subclasses of Process should override the {@link #onExit()} and
* {@link #toHandle()} methods to provide a fully functional Process including the
- * {@link #getPid() process id},
- * {@link #info() information about the process},
- * {@link #children() direct children}, and
- * {@link #descendants() direct children plus descendants of those children} of the process.
+ * {@linkplain #pid() process id},
+ * {@linkplain #info() information about the process},
+ * {@linkplain #children() direct children}, and
+ * {@linkplain #descendants() direct children plus descendants of those children} of the process.
* Delegating to the underlying Process or ProcessHandle is typically
* easiest and most efficient.
*
@@ -237,14 +237,14 @@
/**
* Kills the process.
* Whether the process represented by this {@code Process} object is
- * {@link #supportsNormalTermination normally terminated} or not is
+ * {@linkplain #supportsNormalTermination normally terminated} or not is
* implementation dependent.
* Forcible process destruction is defined as the immediate termination of a
* process, whereas normal termination allows the process to shut down cleanly.
* If the process is not alive, no action is taken.
* <p>
* The {@link java.util.concurrent.CompletableFuture} from {@link #onExit} is
- * {@link java.util.concurrent.CompletableFuture#complete completed}
+ * {@linkplain java.util.concurrent.CompletableFuture#complete completed}
* when the process has terminated.
*/
public abstract void destroy();
@@ -257,7 +257,7 @@
* If the process is not alive, no action is taken.
* <p>
* The {@link java.util.concurrent.CompletableFuture} from {@link #onExit} is
- * {@link java.util.concurrent.CompletableFuture#complete completed}
+ * {@linkplain java.util.concurrent.CompletableFuture#complete completed}
* when the process has terminated.
* <p>
* Invoking this method on {@code Process} objects returned by
@@ -335,15 +335,15 @@
*
* @implSpec
* The implementation of this method returns the process id as:
- * {@link #toHandle toHandle().getPid()}.
+ * {@link #toHandle toHandle().pid()}.
*
* @return the native process id of the process
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
* @since 9
*/
- public long getPid() {
- return toHandle().getPid();
+ public long pid() {
+ return toHandle().pid();
}
/**
@@ -357,9 +357,9 @@
* <p>
* Calling {@code onExit().get()} waits for the process to terminate and returns
* the Process. The future can be used to check if the process is
- * {@link java.util.concurrent.CompletableFuture#isDone done} or to
- * {@link java.util.concurrent.CompletableFuture#get() wait} for it to terminate.
- * {@link java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
+ * {@linkplain java.util.concurrent.CompletableFuture#isDone done} or to
+ * {@linkplain java.util.concurrent.CompletableFuture#get() wait} for it to terminate.
+ * {@linkplain java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
* the CompletableFuture does not affect the Process.
* <p>
* Processes returned from {@link ProcessBuilder#start} override the
@@ -389,7 +389,7 @@
* {@code waitFor} is interrupted, the thread's interrupt status is preserved.
* <p>
* When {@link #waitFor()} returns successfully the CompletableFuture is
- * {@link java.util.concurrent.CompletableFuture#complete completed} regardless
+ * {@linkplain java.util.concurrent.CompletableFuture#complete completed} regardless
* of the exit status of the process.
*
* This implementation may consume a lot of memory for thread stacks if a
@@ -463,7 +463,7 @@
* This implementation throws an instance of
* {@link java.lang.UnsupportedOperationException} and performs no other action.
* Subclasses should override this method to provide a ProcessHandle for the
- * process. The methods {@link #getPid}, {@link #info}, {@link #children},
+ * process. The methods {@link #pid}, {@link #info}, {@link #children},
* and {@link #descendants}, unless overridden, operate on the ProcessHandle.
*
* @return Returns a ProcessHandle for the Process
@@ -500,10 +500,10 @@
/**
* Returns a snapshot of the direct children of the process.
* The parent of a direct child process is the process.
- * Typically, a process that is {@link #isAlive not alive} has no children.
+ * Typically, a process that is {@linkplain #isAlive not alive} has no children.
* <p>
* <em>Note that processes are created and terminate asynchronously.
- * There is no guarantee that a process is {@link #isAlive alive}.
+ * There is no guarantee that a process is {@linkplain #isAlive alive}.
* </em>
*
* @implSpec
@@ -526,10 +526,10 @@
* Returns a snapshot of the descendants of the process.
* The descendants of a process are the children of the process
* plus the descendants of those children, recursively.
- * Typically, a process that is {@link #isAlive not alive} has no children.
+ * Typically, a process that is {@linkplain #isAlive not alive} has no children.
* <p>
* <em>Note that processes are created and terminate asynchronously.
- * There is no guarantee that a process is {@link #isAlive alive}.
+ * There is no guarantee that a process is {@linkplain #isAlive alive}.
* </em>
*
* @implSpec
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@
* @throws UnsupportedOperationException if the implementation
* does not support this operation
*/
- long getPid();
+ long pid();
/**
* Returns an {@code Optional<ProcessHandle>} for an existing native process.
@@ -383,7 +383,7 @@
/**
* Returns a hash code value for this ProcessHandle.
* The hashcode value follows the general contract for {@link Object#hashCode()}.
- * The value is a function of the {@link #getPid getPid()} value and
+ * The value is a function of the {@link #pid pid()} value and
* may be a function of additional information to uniquely identify the process.
* If two ProcessHandles are equal according to the {@link #equals(Object) equals}
* method, then calling the hashCode method on each of the two objects
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Tue Apr 11 14:18:22 2017 -0400
@@ -35,11 +35,7 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
import java.util.stream.Stream;
@@ -176,7 +172,7 @@
throw new IllegalStateException("onExit for current process not allowed");
}
- return ProcessHandleImpl.completion(getPid(), false)
+ return ProcessHandleImpl.completion(pid(), false)
.handleAsync((exitStatus, unusedThrowable) -> this);
}
@@ -259,7 +255,7 @@
* @return the native process ID
*/
@Override
- public long getPid() {
+ public long pid() {
return pid;
}
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -617,7 +617,7 @@
}
@Override
- public long getPid() {
+ public long pid() {
return pid;
}
--- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -523,7 +523,7 @@
@Override
public CompletableFuture<Process> onExit() {
- return ProcessHandleImpl.completion(getPid(), false)
+ return ProcessHandleImpl.completion(pid(), false)
.handleAsync((exitStatus, unusedThrowable) -> this);
}
@@ -550,8 +550,8 @@
private static native void terminateProcess(long handle);
@Override
- public long getPid() {
- return processHandle.getPid();
+ public long pid() {
+ return processHandle.pid();
}
private static native int getProcessId0(long handle);
@@ -572,7 +572,7 @@
@Override
public String toString() {
int exitCode = getExitCodeProcess(handle);
- return new StringBuilder("Process[pid=").append(getPid())
+ return new StringBuilder("Process[pid=").append(pid())
.append(", exitValue=").append(exitCode == STILL_ACTIVE ? "\"not exited\"" : exitCode)
.append("]").toString();
}
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,11 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.List;
import java.util.Map;
import jdk.testlibrary.ProcessTools;
import com.sun.jdi.Bootstrap;
-import com.sun.jdi.ThreadReference;
import com.sun.jdi.VirtualMachine;
import com.sun.jdi.connect.AttachingConnector;
import com.sun.jdi.connect.Connector;
@@ -86,7 +84,7 @@
is.read();
// Attach a debugger
- tryDebug(p.getPid());
+ tryDebug(p.pid());
} finally {
p.destroyForcibly();
}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -311,7 +311,7 @@
if (action.equals("sleep")) {
Thread.sleep(10 * 60 * 1000L);
} else if (action.equals("pid")) {
- System.out.println(ProcessHandle.current().getPid());
+ System.out.println(ProcessHandle.current().pid());
} else if (action.equals("testIO")) {
String expected = "standard input";
char[] buf = new char[expected.length()+1];
@@ -1235,7 +1235,7 @@
Process p = pb.start();
String s = commandOutput(p);
long actualPid = Long.valueOf(s.trim());
- long expectedPid = p.getPid();
+ long expectedPid = p.pid();
equal(actualPid, expectedPid);
} catch (Throwable t) {
unexpected(t);
@@ -1245,7 +1245,7 @@
// Test the default implementation of Process.getPid
DelegatingProcess p = new DelegatingProcess(null);
THROWS(UnsupportedOperationException.class,
- () -> p.getPid(),
+ () -> p.pid(),
() -> p.toHandle(),
() -> p.supportsNormalTermination(),
() -> p.children(),
@@ -2243,7 +2243,7 @@
// Child process waits until it gets input
String s = p.toString();
check(s.contains("not exited"));
- check(s.contains("pid=" + p.getPid() + ","));
+ check(s.contains("pid=" + p.pid() + ","));
new PrintStream(p.getOutputStream()).print("standard input");
p.getOutputStream().close();
@@ -2251,7 +2251,7 @@
// Check the toString after it exits
int exitValue = p.waitFor();
s = p.toString();
- check(s.contains("pid=" + p.getPid() + ","));
+ check(s.contains("pid=" + p.pid() + ","));
check(s.contains("exitValue=" + exitValue) &&
!s.contains("not exited"));
}
--- a/jdk/test/java/lang/ProcessBuilder/PipelineTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessBuilder/PipelineTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -212,7 +212,7 @@
static void print(ProcessHandle p) {
System.out.printf("process: pid: %d, info: %s%n",
- p.getPid(), p.info());
+ p.pid(), p.info());
}
// Check various aspects of the processes
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
! new File("/bin/ps").canExecute())
return;
System.out.println("Looks like a Unix system.");
- long mypid = ProcessHandle.current().getPid();
+ long mypid = ProcessHandle.current().pid();
System.out.printf("mypid: %d%n", mypid);
final Runtime rt = Runtime.getRuntime();
@@ -65,7 +65,7 @@
Process p = rt.exec(TrueCommand);
ProcessHandle pp = p.toHandle().parent().orElse(null);
- System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
+ System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.pid(), pp);
p.waitFor();
// Count all the zombies that are children of this Java process
--- a/jdk/test/java/lang/ProcessHandle/Basic.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessHandle/Basic.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,13 +66,13 @@
public static void test2() {
try {
ProcessHandle self = ProcessHandle.current();
- long pid = self.getPid(); // known native process id
+ long pid = self.pid(); // known native process id
Optional<ProcessHandle> self1 = ProcessHandle.of(pid);
assertEquals(self1.get(), self,
- "ProcessHandle.of(x.getPid()) should be equal getPid() %d: %d");
+ "ProcessHandle.of(x.pid()) should be equal pid() %d: %d");
Optional<ProcessHandle> ph = ProcessHandle.of(pid);
- assertEquals(pid, ph.get().getPid());
+ assertEquals(pid, ph.get().pid());
} finally {
// Cleanup any left over processes
ProcessHandle.current().children().forEach(ProcessHandle::destroy);
@@ -98,7 +98,7 @@
Process p = new ProcessBuilder("sleep", "0").start();
p.waitFor();
- long deadPid = p.getPid();
+ long deadPid = p.pid();
p = null; // Forget the process
Optional<ProcessHandle> t = ProcessHandle.of(deadPid);
--- a/jdk/test/java/lang/ProcessHandle/JavaChild.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessHandle/JavaChild.java Tue Apr 11 14:18:22 2017 -0400
@@ -159,7 +159,7 @@
*/
CompletableFuture<String> forEachOutputLine(Consumer<String> consumer) {
final CompletableFuture<String> future = new CompletableFuture<>();
- String name = "OutputLineReader-" + getPid();
+ String name = "OutputLineReader-" + pid();
Thread t = new Thread(() -> {
try (BufferedReader reader = outputReader()) {
String line;
@@ -167,7 +167,7 @@
consumer.accept(line);
}
} catch (IOException | RuntimeException ex) {
- consumer.accept("IOE (" + getPid() + "):" + ex.getMessage());
+ consumer.accept("IOE (" + pid() + "):" + ex.getMessage());
future.completeExceptionally(ex);
}
future.complete("success");
@@ -327,7 +327,7 @@
try {
p.getOutputStream().close();
} catch (IOException ie) {
- sendResult("stdin_closing", p.getPid(),
+ sendResult("stdin_closing", p.pid(),
"exception", ie.getMessage());
}
}
@@ -352,9 +352,9 @@
"children to terminate%n");
children.removeAll(completedChildren);
for (JavaChild c : children) {
- sendResult("stdin_noterm", c.getPid());
+ sendResult("stdin_noterm", c.pid());
System.err.printf(" Process not terminated: " +
- "pid: %d%n", c.getPid());
+ "pid: %d%n", c.pid());
}
System.exit(2);
}
@@ -386,11 +386,11 @@
System.arraycopy(args, nextArg, subargs, 0, subargs.length);
for (int i = 0; i < ncount; i++) {
JavaChild p = spawnJavaChild(subargs);
- sendResult(action, p.getPid());
+ sendResult(action, p.pid());
p.forEachOutputLine(JavaChild::sendRaw);
p.onJavaChildExit().thenAccept((p1) -> {
int excode = p1.exitValue();
- sendResult("child_exit", p1.getPid(), excode);
+ sendResult("child_exit", p1.pid(), excode);
completedChildren.add(p1);
});
children.add(p); // Add child to spawned list
@@ -410,7 +410,7 @@
if (p.isAlive()) {
sentCount++;
// overwrite with current pid
- result[0] = Long.toString(p.getPid());
+ result[0] = Long.toString(p.pid());
sendResult(action, result);
p.sendAction(args[nextArg], subargs);
}
@@ -426,7 +426,7 @@
// ignoring those that are not alive
for (JavaChild p : children) {
if (p.isAlive()) {
- sendResult(action, p.getPid());
+ sendResult(action, p.pid());
p.getOutputStream().close();
}
}
@@ -505,7 +505,7 @@
String command;
Object[] results;
Event(String command, Object... results) {
- this(self.getPid(), ++commandSeq, command, results);
+ this(self.pid(), ++commandSeq, command, results);
}
Event(long pid, int seq, String command, Object... results) {
this.pid = pid;
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -104,7 +104,7 @@
JavaChild proc = JavaChild.spawnJavaChild("stdin");
procHandle = proc.toHandle();
- printf(" spawned: %d%n", proc.getPid());
+ printf(" spawned: %d%n", proc.pid());
proc.forEachOutputLine((s) -> {
String[] split = s.trim().split(" ");
@@ -235,7 +235,7 @@
} while (!"pid".equals(split[1]));
// Tell B to wait for A's pid
- B.sendAction("waitpid", A.getPid());
+ B.sendAction("waitpid", A.pid());
// Wait a bit to see if B will prematurely report the termination of A
try {
--- a/jdk/test/java/lang/ProcessHandle/ProcessUtil.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessHandle/ProcessUtil.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -199,7 +199,7 @@
*/
static void printProcess(ProcessHandle ph, String prefix) {
printf("%spid %s, alive: %s; parent: %s, %s%n", prefix,
- ph.getPid(), ph.isAlive(), ph.parent(), ph.info());
+ ph.pid(), ph.isAlive(), ph.parent(), ph.info());
}
/**
--- a/jdk/test/java/lang/ProcessHandle/TreeTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
try {
ProcessHandle self = ProcessHandle.current();
- printf("self pid: %d%n", self.getPid());
+ printf("self pid: %d%n", self.pid());
printDeep(self, "");
for (int i = 0; i < MAXCHILDREN; i++) {
@@ -154,7 +154,7 @@
JavaChild p1 = JavaChild.spawnJavaChild("stdin");
ProcessHandle p1Handle = p1.toHandle();
- printf(" p1 pid: %d%n", p1.getPid());
+ printf(" p1 pid: %d%n", p1.pid());
// Gather the PIDs from the output of the spawing process
p1.forEachOutputLine((s) -> {
@@ -206,7 +206,7 @@
// show the complete list of children (for debug)
List<ProcessHandle> descendants = getDescendants(p1Handle);
printf(" descendants: %s%n",
- descendants.stream().map(p -> p.getPid())
+ descendants.stream().map(p -> p.pid())
.collect(Collectors.toList()));
// Verify that all spawned children show up in the descendants List
@@ -252,7 +252,7 @@
JavaChild p1 = JavaChild.spawnJavaChild("stdin");
ProcessHandle p1Handle = p1.toHandle();
- printf(" p1: %s%n", p1.getPid());
+ printf(" p1: %s%n", p1.pid());
int newChildren = 3;
CountDownLatch spawnCount = new CountDownLatch(newChildren);
@@ -356,11 +356,11 @@
parent[sortindex[i]] = processes[sortindex[i]].parent().orElse(null);
}
Arrays.sort(sortindex, (i1, i2) -> {
- int cmp = Long.compare((parent[i1] == null ? 0L : parent[i1].getPid()),
- (parent[i2] == null ? 0L : parent[i2].getPid()));
+ int cmp = Long.compare((parent[i1] == null ? 0L : parent[i1].pid()),
+ (parent[i2] == null ? 0L : parent[i2].pid()));
if (cmp == 0) {
- cmp = Long.compare((processes[i1] == null ? 0L : processes[i1].getPid()),
- (processes[i2] == null ? 0L : processes[i2].getPid()));
+ cmp = Long.compare((processes[i1] == null ? 0L : processes[i1].pid()),
+ (processes[i2] == null ? 0L : processes[i2].pid()));
}
return cmp;
});
@@ -397,7 +397,7 @@
ProcessHandle p1Handle = p1.toHandle();
printf("Spawning %d x %d x %d processes, pid: %d%n",
- factor, factor, factor, p1.getPid());
+ factor, factor, factor, p1.pid());
// Start the first tier of subprocesses
p1.sendAction("spawn", factor, "stdin");
@@ -448,7 +448,7 @@
List<ProcessHandle> subprocesses = getDescendants(p1Handle);
printf(" descendants: %s%n",
- subprocesses.stream().map(p -> p.getPid())
+ subprocesses.stream().map(p -> p.pid())
.collect(Collectors.toList()));
p1.getOutputStream().close(); // Close stdin for the controlling p1
--- a/jdk/test/java/lang/Runtime/exec/SleepyCat.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/lang/Runtime/exec/SleepyCat.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -80,10 +80,10 @@
for (Process p : pids) {
if (p == null)
continue;
- String[] pfiles = {"pfiles", Long.toString(p.getPid())};
+ String[] pfiles = {"pfiles", Long.toString(p.pid())};
fds = new ProcessBuilder(pfiles).inheritIO().start();
fds.waitFor();
- String[] pstack = {"pstack", Long.toString(p.getPid())};
+ String[] pstack = {"pstack", Long.toString(p.pid())};
fds = new ProcessBuilder(pstack).inheritIO().start();
fds.waitFor();
}
--- a/jdk/test/java/util/logging/LoggingDeadlock2.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/java/util/logging/LoggingDeadlock2.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -263,7 +263,7 @@
sleep(ms);
System.err.println("Timeout reached: " + ms);
if (process.isAlive()) {
- long pid = process.getPid();
+ long pid = process.pid();
ProcessBuilder jstack = new ProcessBuilder(jstackExe, String.valueOf(pid));
System.err.println("Dumping subprocess stack: " + pid);
Process p = jstack.inheritIO().start();
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
import java.io.PrintWriter;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
/**
@@ -195,7 +194,7 @@
* @return The PID associated with this process runnable
*/
public long getPid() throws InterruptedException {
- return getProcess().getPid();
+ return getProcess().pid();
}
public void sendMessage(String message) throws InterruptedException {
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -256,7 +256,7 @@
* @return Process id
*/
public static long getProcessId() {
- return ProcessHandle.current().getPid();
+ return ProcessHandle.current().pid();
}
/**
@@ -542,8 +542,8 @@
}
@Override
- public long getPid() {
- return p.getPid();
+ public long pid() {
+ return p.pid();
}
@Override
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,7 @@
System.out.println("Attaching test manager:");
System.out.println("=========================");
- System.out.println(" PID : " + serverPrc.getPid());
+ System.out.println(" PID : " + serverPrc.pid());
System.out.println(" shutdown port : " + port.get());
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -152,7 +152,7 @@
TEST_CLASSPATH,
"--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
- String.valueOf(serverPrc.getPid()),
+ String.valueOf(serverPrc.pid()),
port.get(),
"true"
);
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -129,7 +129,7 @@
System.out.println("Attaching test manager:");
System.out.println("=========================");
- System.out.println(" PID : " + serverPrc.getPid());
+ System.out.println(" PID : " + serverPrc.pid());
System.out.println(" shutdown port : " + port.get());
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -137,7 +137,7 @@
TEST_CLASSPATH,
"--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
- String.valueOf(serverPrc.getPid()),
+ String.valueOf(serverPrc.pid()),
port.get(),
"true"
);
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -346,7 +346,7 @@
throw new BindException("Starting process failed due to " +
"the requested port not being available");
}
- pid = p.getPid();
+ pid = p.pid();
} catch (TimeoutException e) {
if (p != null) {
p.destroy();
--- a/jdk/test/sun/tools/jps/LingeredApp.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/sun/tools/jps/LingeredApp.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@
if (appProcess == null) {
throw new RuntimeException("Process is not alive");
}
- return appProcess.getPid();
+ return appProcess.pid();
}
/**
--- a/jdk/test/sun/tools/jstat/JStatInterval.java Tue Apr 11 16:32:38 2017 +0100
+++ b/jdk/test/sun/tools/jstat/JStatInterval.java Tue Apr 11 14:18:22 2017 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,11 +36,8 @@
import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
public class JStatInterval {
private static final String READY = "READY";
@@ -88,7 +85,7 @@
throw new Error("Unable to start the monitored application.");
}
- String pidStr = String.valueOf(app.getPid());
+ String pidStr = String.valueOf(app.pid());
JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jstat");
l.addToolArg("-compiler");
l.addToolArg(pidStr);