You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tim Gordon <ti...@allustra.com> on 2007/02/27 12:27:13 UTC
RE: Getting the process id of a process started by ANT
Hello Supriya
To my knowledge there is no way of killing a process by ID from Java - it's
not available as part of the API. Perhaps Sun have done this deliberately as
it's a potential security risk - that would make sense.
A cleaner way to kill off a process is to get it to shut itself down by
issuing a command remotely. You could start a JMX container inside the JVM
you launch and then issue a shutdown command to it. This is how JBoss can be
shut down, for example. It's very easy to set this sort of thing up using
the Spring framework. The only drawback to this is that you'll need a unique
port per process and technically anyone who connects to your server could
shut it down - it's a security hazard. Again Spring has lots of facilities
in it to secure and authenticate your connection should you want to do this
to production quality.
In our system we basically have a peer server which all of the other servers
register with by name. If you want to shut a server down you run a client
which logs on to the peer and then tells the server via the peer to shut
down.
Tim Gordon
Allustra Limited
Paxton House
30 Artillery Lane
London
E1 7LS
Tel +44 (0)20 7539 5722
Fax +44 (0)20 7539 5732
http://www.allustra.com/
_____
From: supriya sharma [mailto:gcetgraduate_it@yahoo.com]
Sent: 27 February 2007 10:40
To: tim.gordon@allustra.com
Subject: Getting the process id of a process started by ANT
Hi Tim,
I found an issue raised by you in Apache Ant forum which states that :
"I've written an ANT script which launches some processes - is there a
platform-independent way to get the process id of those processes as they're
launched - I need a way of killing them off ."
Even I am having the same issue. I am starting certain executables from Ant
but dont know how to kill them after the task is over.
I thought may be you have got the answer to my query.It will be really nice
of you if you can help.
Thanks
Supriya
Send instant messages to your online friends http://uk.messenger.yahoo.com
RE: Getting the process id of a process started by ANT
Posted by Vladimir Egorov <ve...@bea.com>.
> In our system we basically have a peer server which all of the other
> servers
> register with by name. If you want to shut a server down you run a
client
> which logs on to the peer and then tells the server via the peer to
shut
> down.
Tim, is your system generic so that it can manage any process this way,
or only 'servers'. If it is generic, is it something I can look at?
Thanks, --Vladimir
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org