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

javaws process should wait until java process exit

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: deploy

      Description

      While looking at all of the instances of create process, we should look into creating a job so that the instance of Java is tied to Javaws. here is an example:

      STARTUPINFOW siStartupInfo;
      PROCESS_INFORMATION piProcessInfo;
      memset(&siStartupInfo, 0, sizeof(siStartupInfo));
      memset(&piProcessInfo, 0, sizeof(piProcessInfo));
      siStartupInfo.cb = sizeof(siStartupInfo);

      HANDLE jobHandle = CreateJobObject(NULL, NULL);

      if (jobHandle == NULL)
      {
      ::MessageBox(0, TEXT("CreateJobObject Failed"), TEXT("hgMerge"), MB_OK);
      }

      // Configure all child processes associated with the job to terminate when the
      JOBOBJECT_EXTENDED_LIMIT_INFORMATION JobInfo = { 0 };
      JobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;

      if (SetInformationJobObject( jobHandle, JobObjectExtendedLimitInformation, &JobInfo, sizeof(JobInfo)) == 0)
      {
      ::MessageBox(0, TEXT("SetInformationJobObject Failed"), TEXT("hgMerge"), MB_OK);
      }

      if (CreateProcessW(app, params, 0, 0, false, /*CREATE_DEFAULT_ERROR_MODE*/NORMAL_PRIORITY_CLASS | CREATE_BREAKAWAY_FROM_JOB, 0, 0,
      &siStartupInfo, &piProcessInfo) != false)
      {
      if (AssignProcessToJobObject(jobHandle, piProcessInfo.hProcess) == 0)
      {
      }

      DWORD dwExitCode = WaitForSingleObject(piProcessInfo.hProcess, INFINITE);

      //TODO do something with dwExitCode
      }

      CloseHandle(jobHandle);

        Attachments

          Activity

            People

            • Assignee:
              dcherepanov Dmitry Cherepanov
              Reporter:
              ngthomas Thomas Ng (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: