Obtain process ID of DefaultExecutor process
"Tenenbaum, Peter G. (ARC-TN)[SETI INSTITUTE] via user" <[email protected]> Fri, 20 Feb 2026 21:36:34 +0000
| Newsgroups | gmane.comp.jakarta.commons.user |
|---|---|
| Message-ID | <CO6PR09MB79270FC901E96B4F578BD2A48068A@CO6PR09MB7927.namprd09.prod.outlook.com> |
--_000_CO6PR09MB79270FC901E96B4F578BD2A48068ACO6PR09MB7927namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi there =97 I was looking for a way to get the process ID of a process that gets starte= d by the DefaultExecutor. From looking at the javadoc, there=92s no built-i= n way to do it. Google recommends that I create a subclass of DefaultExecutor that override= s the launch() method, such that the Process it returns is interrogated for= the PID. DefaultExecutor isn=92t final and launch() is protected, so in pr= inciple this can be done. However: The only public constructor for DefaultExecutor is deprecated. The non-depr= ecated method to instantiate a DefaultExecutor is to use the DefaultExecuto= r builder, but AFAICT there=92s no way to get this builder to return a Defa= ultExecutor subclass. I could subclass the DefaultExecutor builder, but the= DefaultExecutor builder uses a package-private DefaultExecutor constructor= , so my subclass of DefaultExecutor builder can=92t use that constructor. In a pinch, I could imagine giving my subclass its own constructor that emu= lates the package-private one in DefaultExecutor. Unfortunately, this also = won=92t work: all the instance variables are private and there are no prote= cted setters for them. It seems like the intent is there to allow users to subclass DefaultExecuto= r, but in practice the only way to do it appears to be the deprecated publi= c constructor. Am I missing something? Is there an easier way to get the PID from a DefaultExecutor? Thanks, -PT --_000_CO6PR09MB79270FC901E96B4F578BD2A48068ACO6PR09MB7927namp_--