Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4244896

(process) Provide Process.waitFor(timeout), Process.destroyForcibly() and Process.isAlive()

XMLWordPrintable

    • b47
    • generic, x86
    • generic, windows_2000, windows_xp
    • Verified

      Name: vi73552 Date: 06/08/99


      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)
      ======================================================================

            robm Robert Mckenna
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: