JDK-4333183 : (process) Add a way to gently shutdown, as opposed to destroy, a subprocess
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.2,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.6,solaris_8
  • CPU: sparc
  • Submitted: 2000-04-25
  • Updated: 2015-06-05
  • Resolved: 2015-06-05
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
Name: stC104175			Date: 04/25/2000


java version "1.2.2"
HotSpot VM (1.0.1, mixed mode, build f)

I would like 'getPid()' method to added to the 'Process' class. This will allow
me to write a native 'kill()' method so that a C/C++ subprocess invoked by one
of the 'Runtime.exec()' methods could be shutdown cleanly rather than having to
destroy it.
(Review ID: 104114) 
======================================================================

Comments
The PID is provided by the new ProcessHandle API. Also, the behavior of Process.destroy is defined to gracefully terminate processes started from ProcessBuilder.
05-06-2015

WORK AROUND Name: stC104175 Date: 04/25/2000 I can invoke an intermediate program via the'Runtime.exec(String cmd[])'method which subsequently invokes the C/C++ application via the exec(2) function. This intermediate program also prints its process id, which can be read from the Java application by obtaining and reading the returned Process object instance OutputStream object instance. ======================================================================
11-09-2004

EVALUATION Perhaps the user's underlying need, a way to shut down a Runtime.exec'd process cleanly, should be addressed directly. william.maddox@Eng 2000-05-04 Agreed. The notion of process id is inherently system-dependent and should not be exposed at the Java API level. I've therefore changed this into an RFE for a way to gently shutdown a subprocess. -- ###@###.### 2002/3/15
03-10-0181