Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-06-26 Thread Rob McKenna
Thanks Thomas, As per Alan's mail, we're going to deal with this as a separate issue after we've discussed it. -Rob On 25/06/12 10:52, Alan Bateman wrote: On 25/06/2012 09:56, Thomas Stüfe wrote: Hi, Rob, src/solaris/native/java/lang/UNIXProcess_md.c: You never check the return code

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-06-25 Thread Thomas Stüfe
Hi, Rob, src/solaris/native/java/lang/UNIXProcess_md.c: You never check the return code of kill(2). kill() may fail if you have no permission to kill the process (EPERM), or if the process id is invalid, maybe it has already been reaped. In both cases an exception would be nice, or if you decide

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-06-25 Thread Alan Bateman
On 25/06/2012 09:56, Thomas Stüfe wrote: Hi, Rob, src/solaris/native/java/lang/UNIXProcess_md.c: You never check the return code of kill(2). kill() may fail if you have no permission to kill the process (EPERM), or if the process id is invalid, maybe it has already been reaped. In both cases

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-06-25 Thread Alan Bateman
On 24/06/2012 13:57, Rob McKenna wrote: Hi folks, 5th, and hopefully final review has been posted to: http://cr.openjdk.java.net/~robm/4244896/webrev.05/ http://cr.openjdk.java.net/%7Erobm/4244896/webrev.05/ Let me know if there are any comments or concerns, and thanks a lot for the help

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-06-24 Thread David Holmes
Hi Rob, A couple of minor things ... Process.waitFor: + long startTime = System.nanoTime(); + long rem = unit.toNanos(timeout) - (System.nanoTime() - startTime); should just be + long startTime = System.nanoTime(); + long rem = unit.toNanos(timeout); The

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-06-01 Thread Alan Bateman
On 31/05/2012 17:48, Rob McKenna wrote: That link should be: http://cr.openjdk.java.net/~robm/4244896/webrev.04/ -Rob I'm happy the spec has come good too. One small suggestion is to tweak this line: {@code Process} objects returned by {@link ProcessBuilder#start} and {@link

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-31 Thread Rob McKenna
That link should be: http://cr.openjdk.java.net/~robm/4244896/webrev.04/ -Rob On 31/05/12 16:05, Rob McKenna wrote: Latest version including work on the spec language: http://cr.openjdk.java.net/~robm/4244896/webrev.04/ http://cr.openjdk.java.net/%7Erobm/4244896/webrev.03/ -Rob

Re : review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-31 Thread Jeff Hain
Hi. 185 public boolean waitFor(long timeout, TimeUnit unit) 186 throws InterruptedException { 187 long now = System.nanoTime(); 188 189 long end = now + 190 (timeout = 0 ? 0 : TimeUnit.NANOSECONDS.convert(timeout, unit)); 191

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-31 Thread David Holmes
Hi Rob, This looks good to me. I'm glad to see that destroyForcibly mandates that Process instances from ProcessBuilder.start and Runtime.exec must do a forcible destroy. That addresses my concern about documenting the actual implementations. Two minor comments: Process.java: 236 *

Re: Re : review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-31 Thread David Holmes
Jeff, On 1/06/2012 10:19 AM, Jeff Hain wrote: Hi. 185 public boolean waitFor(long timeout, TimeUnit unit) 186 throws InterruptedException { 187 long now = System.nanoTime(); 188 189 long end = now + 190 (timeout= 0 ? 0 :

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-14 Thread David Holmes
Hi Rob, Your specification for Process.waitFor(long timeout, TimeUnit unit) has a conflict. You presently say: If the subprocess has already exited then this method returns immediately with the value {@code true} and you also say: If the current thread: has its interrupted status set on

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-11 Thread Paul Sandoz
Hi Rob, I dunno if the following has been pointed out before. It's hard to track review comments. The implementation of Process.waitFor normalizes the end time and duration remaining time to nano seconds. However, the Thread.sleep method expects a duration in units of milliseconds. You

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-11 Thread Rob McKenna
Hi Paul, Comments inline: On 11/05/12 12:29, Paul Sandoz wrote: Hi Rob, I dunno if the following has been pointed out before. It's hard to track review comments. The implementation of Process.waitFor normalizes the end time and duration remaining time to nano seconds. However, the

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-11 Thread Paul Sandoz
On May 11, 2012, at 5:24 PM, Rob McKenna wrote: For the following code: 227 long rem = end - now; 228 while (!hasExited (rem 0)) { 229 wait(TimeUnit.NANOSECONDS.toMillis(rem)); 230 rem = end - System.nanoTime(); 231 } Can the

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-05-10 Thread Rob McKenna
Hi folks, The latest version is at: http://cr.openjdk.java.net/~robm/4244896/webrev.03/ http://cr.openjdk.java.net/%7Erobm/4244896/webrev.03/ Feedback greatly appreciated. -Rob On 19/04/12 12:05, Alan Bateman wrote: On 19/04/2012 01:05, David Holmes wrote: On 18/04/2012 11:44 PM,

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-22 Thread David Holmes
The process reaper thread will be calling process.notifyAll() so this is not simply a sleep. In which case the correct form would be: public synchronized boolean waitFor(long timeout, TimeUnit unit) { ... while (!hasExited) { wait(timeLeft); if (!hasExited) { timeleft

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-20 Thread David Holmes
Rob, You can't use wait this way: 217 public synchronized boolean waitFor(long timeout, TimeUnit unit) 218 throws InterruptedException { 219 long millis = unit.toMillis(timeout); 220 long nanos = unit.toNanos(timeout) % (millis * 100); 221 222 if

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-20 Thread David Holmes
Correction: On 20/04/2012 7:15 PM, David Holmes wrote: Rob, You can't use wait this way: 217 public synchronized boolean waitFor(long timeout, TimeUnit unit) 218 throws InterruptedException { 219 long millis = unit.toMillis(timeout); 220 long nanos = unit.toNanos(timeout) % (millis *

RE: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-20 Thread Jason Mehrens
Rob, 2) As Alan noted, there is really no need for isAlive() if people are happy with the idea of waitFor(long, TimeUnit). I'd appreciate any feedback on this aspect of the fix. Process.isAlive is similar to Future.isDone(). I think isAlive fills that need to have a simple query method

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-20 Thread Roger Riggs
Please avoid the cross package dependency on j.u.TimeUnit. Keeping mind that in Java ME we have to subset the API to make it fit and that forciblyDestroy is needed iit would be cleaner to avoid the dependency unless there will be a form of the method that uses only a fixed time unit

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-20 Thread Rob McKenna
Thanks a lot for the feedback folks. Jason, as Alan notes, that makes a lot of sense. Thanks for that. I'm planning to do the following over the next couple of days: - fix UnixProcess.waitFor(long, TimeUnit) as per David's mail. - alter the default waitFor(long, TimeUnit)

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-19 Thread Alan Bateman
On 19/04/2012 01:05, David Holmes wrote: On 18/04/2012 11:44 PM, Jason Mehrens wrote: Rob, It looks like waitFor is calling Object.wait(long) without owning this objects monitor. If I pass Long.MAX_VALUE to waitFor, shouldn't waitFor return if the early if the process ends? Also waitFor

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-19 Thread Rob McKenna
I've uploaded another webrev to: http://cr.openjdk.java.net/~robm/4244896/webrev.02/ http://cr.openjdk.java.net/%7Erobm/4244896/webrev.02/ I plan to spend some time over the coming day or two beefing up the test for waitFor (right now its really geared towards destroyForcibly) so I won't

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-19 Thread David Holmes
Hi Rob, On 20/04/2012 11:33 AM, Rob McKenna wrote: I've uploaded another webrev to: http://cr.openjdk.java.net/~robm/4244896/webrev.02/ http://cr.openjdk.java.net/%7Erobm/4244896/webrev.02/ I'll take a look as soon as I have a chance but will be OOTO the rest of today. I plan to spend

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-19 Thread Rob McKenna
Thanks David, I suspect Alan simply meant that it may be preferable to use System.nanoTime to measure the time elapsed in the default implementation as opposed to System.currentTimeMillis. I had forgotten about the lower resolution of the timer interrupt. I'll revert that aspect of the

RE: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-18 Thread Jason Mehrens
...@oracle.com Subject: Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid) CC: core-libs-dev@openjdk.java.net New webrev at: http://cr.openjdk.java.net/~robm/4244896/webrev.01/ Differences: - implemented Process.waitFor(long timeout). I figured I'd

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-18 Thread Rob McKenna
if the process ends? Jason Date: Tue, 17 Apr 2012 15:56:30 +0100 From: rob.mcke...@oracle.com To: alan.bate...@oracle.com Subject: Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid) CC: core-libs-dev@openjdk.java.net New webrev at: http

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-18 Thread David Holmes
Jason Date: Tue, 17 Apr 2012 15:56:30 +0100 From: rob.mcke...@oracle.com To: alan.bate...@oracle.com Subject: Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid) CC: core-libs-dev@openjdk.java.net New webrev at: http://cr.openjdk.java.net/~robm

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-17 Thread Rob McKenna
New webrev at: http://cr.openjdk.java.net/~robm/4244896/webrev.01/ Differences: - implemented Process.waitFor(long timeout). I figured I'd throw it in and let you decide if you want to keep it / replace isAlive. - implemented defaults in Process.java - destroyForcibly now returns the Process

Re: review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

2012-04-12 Thread Alan Bateman
On 12/04/2012 00:48, Rob McKenna wrote: Hi folks, I'm hoping for some feedback on the above. Webrev: http://cr.openjdk.java.net/~robm/4244896/webrev.00/ Thanks for taking this one on, a destroyForcibly is really useful to have (destroy was always misleading given that that is was actually a