[GRASS-user] The tomcat shut down when encounter some error grass
commond
maven apache
apachemaven0 at gmail.com
Sun Sep 20 21:25:14 EDT 2009
Thanks Glynn Clements:
I noticed that you have mentioned Grass library more than one times?
I think I did not use them?
I just have three java class the handle the grass commond,and the real call
of grass is through the Runtime.exec() method ,it do open a new process.
2009/9/21 Glynn Clements <glynn at gclements.plus.com>
>
> maven apache wrote:
>
> > I am not exactly sure your meaning.
> > What is short-lived process and what is persisitent process>?
>
> By "short-lived non-interactive command", I'm talking about a typical
> GRASS command: it reads parameters from the command line, performs
> some processing, then exits. If there are any errors, then it just
> exits, often without performing any significant processing.
>
> By "persistent process" I'm talking about something like a daemon or a
> GUI application, which performs multiple operations, and keeps
> performing operations until it is specifically instructed to
> terminate.
>
> > Did you mean that if a process takes long time,then a error can terminate
> > this thread?
>
> It doesn't matter how long it takes; any error will normally terminate
> the process. For a simple command, this isn't a problem; if the
> library function didn't terminate the process, the main program would
> terminate itself once the error was reported.
>
> But for a persistent process which performs multiple operations, an
> error would normally result in it aborting the current operation then
> proceding to the next operation. This isn't possible if you're using
> the GRASS libraries, as they don't generally permit the process to
> continue after an error has occurred.
>
> > and the web server is in the same thread,so it is shut down?
> > If so ,does it mean that I should open a new thread for each grass
> commond?
>
> This is about processes, not threads.
>
> AFAIK, Tomcat behaves as a server, receiving requests from Apache and
> passing them to Java modules for processing. If you use Tomcat to run
> a module which uses GRASS library functions, if the GRASS library
> function signals an error, it will call exit() which will terminate
> the current process, i.e. it will terminate Tomcat.
>
> If you want to avoid this, you need to process each request in a
> separate *process*; a separate thread doesn't help, as exit()
> terminates the process, not just a thread.
>
> AFAICT, Java doesn't have an equivalent of fork() (which doesn't exist
> on Windows); the normal mechanism for creating processes is with
> Runtime.exec(). I have no idea whether this is even permitted from
> within Tomcat, or whether there are any complications involved.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20090921/58909e1e/attachment.html
More information about the grass-user
mailing list