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

(process) Add void Runtime.destroyProcess(int pid), int Runtime.getProcessStatus(int pid)

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      A DESCRIPTION OF THE REQUEST :
      It is imposible with standart Runtime and Process methods for programmer to detrmine if there is somthing wrong with external process.

      Example:
      1. I start a linux mplayer external process and execute Runtime.exec() in separate thread and call waitFor() method.
      2. for some reason mplayer gets into non-working state and can't finish - example when mplayer plays remote file from NFS. If ressource become unavailable mplayer just blocks and it is imopssible for Java to dermine if mplayer works "normally" and some video is playing or mplayer is "frozen" on last file frame and waits ressource to become available again.

      resume: it is impossible to know if 2min AVI video is playing or it is frozen for 1hour for some reason.

      JUSTIFICATION :
      If programmer can get at any time status of OS process it will be possoble to plan and implement appropriate behavior for the application - for example to kill the process and to notify user for problem.

      If this is not possoble for all OS processes (which may be the case) it must be available at least for processes that are started with Runtime.exec()

      Currently implemented Process.destroy() does not work poperly on self-forked(for example mplayer with "-loop 0" option) processes.

      Problem occurs on heavi load with 6x video outs on signle PC with consatt execute/destroy actions on each 4-5 seconds.

      Note that Process.destroy() working fine with any laod with single (non-self-forked) processes.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      java.lang.Process class
      /* returns process OS PID*/
      public static int Process.getPID();

      java.lang.Runtime class
      /* destroys OS process coressponding the given OS PID*/
      public static void destroy(int processPID) throws SomeExceptionXXX;

      /* gets int predefined constamts that desribes current OS process status(for the given PID)*/
      public static int getStatus(int processPID) throws SomeExceptionXXX;

      ACTUAL -
      Currently implemented Process.destroy() does not work poperly on self-forked(for example mplayer with "-loop 0" option) processes.

      Problem occurs on heavi load with 6x video outs on signle PC with consatt execute/destroy actions on each 4-5 seconds.

      Note that Process.destroy() working fine with any laod with single (non-self-forked) processes.

      CUSTOMER SUBMITTED WORKAROUND :
      C native code that implements needed functionality - platform dependent and not good idea.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                robm Robert Mckenna
                Reporter:
                gmanwanisunw Girish Manwani (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: