JDK-8003490 : (process) Provide Process.getCurrentPid() to get identifier of current process
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-11-15
  • Updated: 2015-06-01
  • Resolved: 2015-06-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Blocks :  
Blocks :  
Blocks :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Add a facility to query the id of the JVM's process. Important note from Alan Bateman:

"You probably know this but a getPid and perhaps a getCurrentPid requires great care. We cannot assume
that it can be represented by an int or long, it needs to allow for environment that might not have the notion of process as we know it, also needs consideration of environment where they may be several VMs running in the same process. So lots of wriggle room in the spec, otherwise it will not be implementable everywhere. " 
Comments
This function is provided by java.lang.ProcessHandle.current().getPid(). See 8077350
01-06-2015