Hi,
RFE: Needs getPid(), getEnvVar(), killProcess(String pid) From the java.lang.System class
1. getPid() => shuld able to give the process id of the jvm process
it is running in (java.exe)
2. getEnvVar() => shuld able to return either Windows/Unix Environment
Variable
[for this, please see bug 4199068]
3. killProcess(String pid) => shuld kill the process given the pid
if the process has permissions to do so
This functions are important and avialable in the two most popular
os's windows and unix. In case if a particular os does not have support
for this two calls you can return UnSupportedMethodExcetion.
In our server development lot of times we needed these functions
we wrote a jni C wrapper to get this values which will make the code
not 100% pure java code
Please let me know if you need any further info
Thanks,
Rama Krishna
###@###.###
(Review ID: 84103)
======================================================================
Name: rmT116609 Date: 06/10/2003
A DESCRIPTION OF THE REQUEST :
There are some ways for checking for a running application's instance (creating lock file, creating a listening socket, RMI invocation) but they are all unnecessary unsecure (socket, RMI) or typically unsafe (lock file -- since you can remove it under Unices).
Since Windows'es are supporting PIDs/mutexes, there is a uniform possibility to check for single instance -- create a PID file. Unfortunately, there is no way to get PID for running Java app from Java itself.
JUSTIFICATION :
It would be a great improvement to integrate a getPID() method. It can be also useful for some other purposes.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Something like this:
(int) java.lang.System.getPID();
(Review ID: 187540)
======================================================================
- duplicates
-
JDK-4250622 RFE: Please provide access to process ID
- Closed
-
JDK-4073195 (process) Process.destroy() isn't guaranteed to kill child process on Solaris
- Closed
-
JDK-4076796 (process) Provide Process.isAlive(), like Thread.isAlive()
- Closed
-
JDK-4890847 (process) Add Process.ID and Process.waitFor(long timeout)
- Closed
-
JDK-6316105 (process) Add void Runtime.destroyProcess(int pid), int Runtime.getProcessStatus(int pid)
- Closed
- relates to
-
JDK-8003490 (process) Provide Process.getCurrentPid() to get identifier of current process
- Resolved
-
JDK-8003488 (process) Provide Process.getPid()
- Closed
-
JDK-6987415 (process) Process does not have a method to gently terminate
- Closed
-
JDK-4199068 Please return the functionality of getenv()
- Resolved
-
JDK-4073195 (process) Process.destroy() isn't guaranteed to kill child process on Solaris
- Closed
-
JDK-6447323 (process) Native OS process information and control
- Closed