RE: Re: Obtain process ID of DefaultExecutor process
Jose Nos <[email protected]> Sat, 28 Feb 2026 19:36:13 -0600
| Newsgroups | gmane.comp.jakarta.commons.user |
|---|---|
| Message-ID | <CAFfAsMM71w1LgDVL5gs_gVFgxMLCe8n7Ba-Jzs3-4ejD_V1QpA@mail.gmail.com> |
--000000000000a2af4d064bec7f83 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 2026/02/25 20:53:06 Gary Gregory wrote: > On Sat, Feb 21, 2026 at 9:12=E2=80=AFAM Tenenbaum, Peter G. (ARC-TN)[SETI > INSTITUTE] via user <[email protected]> wrote: > > > > Hi there =E2=80=94 > > > > I was looking for a way to get the process ID of a process that gets started by the DefaultExecutor. From looking at the javadoc, there=E2=80=99= s no built-in way to do it. > > > > Google recommends that I create a subclass of DefaultExecutor that overrides the launch() method, such that the Process it returns is interrogated for the PID. DefaultExecutor isn=E2=80=99t final and launch() = is protected, so in principle this can be done. > > > > However: > > > > The only public constructor for DefaultExecutor is deprecated. The non-deprecated method to instantiate a DefaultExecutor is to use the DefaultExecutor builder, but AFAICT there=E2=80=99s no way to get this buil= der to return a DefaultExecutor subclass. I could subclass the DefaultExecutor builder, but the DefaultExecutor builder uses a package-private DefaultExecutor constructor, so my subclass of DefaultExecutor builder can=E2=80=99t use that constructor. > > > > In a pinch, I could imagine giving my subclass its own constructor that emulates the package-private one in DefaultExecutor. Unfortunately, this also won=E2=80=99t work: all the instance variables are private and there a= re no protected setters for them. > > > > It seems like the intent is there to allow users to subclass DefaultExecutor, but in practice the only way to do it appears to be the deprecated public constructor. Am I missing something? > > > > Is there an easier way to get the PID from a DefaultExecutor? > > Hello PT, > > Have you tried registering an ExecuteWatchdog with a DefaultExecutor? > It accepts a Process that you can query. > > Gary > > > > > Thanks, > > -PT > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --000000000000a2af4d064bec7f83--