JDK-4505263 : RFE: Runtime.exec() with flag, whether calling process inherits handles
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-09-20
  • Updated: 2002-02-26
  • Resolved: 2002-02-26
Related Reports
Duplicate :  

Name: nt126004			Date: 09/20/2001

If you execute a process via java.lang.Runtime.exec(), the new process inherits
all handles from the calling process.

Under some circumstances, it will be necessary, that the callee does not
inherit the handles (e.g. TCP listen ports).

1. Process A opens a TCP listener.
2. Process A executes process B, that runs for some time.
3. Process A fails and terminates.
4. A watchdog restarts process A.
5. Process A cannot open its TCP listener, since the port is still in use (by B).
(Review ID: 132241) 

WORK AROUND Name: nt126004 Date: 09/20/2001 Customer Workaround: The above does not occur, if process B is started from process A via some native code, that prevents the handles from being inherited by process B. (process A starts native code ; native code starts process B). ======================================================================