[Pellet-users] Shutting down the Pellet DIG serverr

Robert Davey robert.davey at bbsrc.ac.uk
Fri Jul 27 10:39:06 UTC 2007


Hi Sidney,

There are well-known irritations with the Java Process implementations,
and this is one of them.

If you have a Process p1, started using Runtime.exec() or
ProcessBuilder.start(), which then forks another process p2 and then p1
dies or is finished successfully, p2 can remain running and cannot be
stopped by using the Process.destroy() method.  The problem is
compounded by the fact that different OSs spawn and kill processes in
different ways, e.g. kill for *nix and TerminateProcess for win32.

This is a highly interesting and recent thread about the issue (I found
threads dating back to 2000 documenting the Process.destroy foibles):

http://forums.java.net/jive/thread.jspa?messageID=212448

I quote:

'When you write "cmd /c whatever.exe" you start TWO processes, the
cmd.exe and whatever.exe. From java's point of view it started cmd, so
the Process p is a handle on this process, so when u call p.destroy(),
this is what gets destroyed, the second process is left running. The
easiest way around this is to start myProcess directly from the exec
command. If your process neither requires or produces console output
then this is the way to go. p.destroy() will work properly'

How are you starting the DIG reasoner using Runtime.exec()?

Cheers

Rob

---------------------------------------
Dr. Rob Davey
NCYC / Institute of Food Research
Computational Biology / John Innes Centre
Norwich Research Park
Norwich, Norfolk, NR4 7HU

http://cbr.jic.ac.uk/dicks/
---------------------------------------

On Tue, 2007-07-24 at 17:31 -0400, Sidney Bailin wrote:
> Is there a graceful way to shut down the Pellet DIG server? E.g., an
> http request? I've looked through the docs, and although I see a stop
> method in the java API docs, I'm not sure how to get it executed.
>  
> In my java application (which is a protege application, i.e., uses the
> protege api to access the reasoner), I'm starting the DIG
> server through a Runtime.exec command in my java program, but calling
> destroy() to the resulting process object isn't working to terminate
> the process.
>  
> Any advice would be welcome. 
>  
> Cheers,
> Sidney Bailin
> Knowledge Evolution, Inc.
> sbailin at kevol.com
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
> 
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/




More information about the Pellet-users mailing list