The child process can get ist own PID and print it on startup:

ManagementFactory.getRuntimeMXBean().getName()

This returns an undefined name of the virtzual machine, but in windows and all 
UNIX it contains the PID. Looks like pid@localhost. But this is enough to 
prevent user error when killing and signaling JVMs.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Dawid Weiss
> Sent: Friday, December 07, 2012 2:03 PM
> To: [email protected]
> Subject: Re: [JENKINS] Lucene-Solr-4.x-Linux (32bit/jdk1.6.0_37) - Build #
> 3089 - Failure!
> 
> > The PID of the own Java process can be retrieved from the child by the
> > javax.Management API! I have to lookup the code!
> 
> PIDs are generally not available, supposedly because on some platforms they
> may not be available... they're currently adding them in JDK8.
> 
> What you're referring to is the hack that everyone's using but it doesn't
> guarantee what you'll get is actually a PID.
> 
> Dawid
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected] For additional
> commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to