On Wed, Dec 14, 2011 at 8:17 PM, Christopher Schultz < ch...@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hernán, > > On 12/14/11 5:45 PM, hernan wrote: > > I'm using Tomcat 7.0 for developing a new application. A key > > component in the application have to run an external not > > multithreaded application. > > > > Since I'm not an experienced user in Tomcat, I wonder which > > implementation alternatives do you recommend for running my > > external application. I'm trying to avoid launch a new os process > > from java since I need the result of that process, so in this way > > I've to deal communicating two processes (may be using serializable > > objects using sockets). > > So, is this other program a Java program? Since you said > "serializable" you probably are talking about running another Java > "program". > > What makes this "external" "program" non-multithreaded? Is it actually > not threadsafe? > > If you can't run it in the same process as Tomcat, then you'll have to > either use Runtime.exec or some type of wrapper around it -- or have > that process running completely separately (as a daemon) and connect > to it via sockets. Anything else requires native code, which you > definitely don't want. My external application is a java application that uses java wrapper (using JNI) for GLPK (written in ANSI C) (http://www.gnu.org/s/glpk/), and GLPK is not threadsafe. Yes, I will consider those alternatives, executing a new process when I receive the request (Runtime.exec) and a separated deamon receiving requests launching those processes. > > I want to know which kind of approachs are used to deal with these > > type of situations. > > What about running in-process? Even if the class(es) is(are) not > threadsafe, you might be able to use separate instances from your > request processor threads. Can I configure tomcat for running a new (or different) process for each request? or I have to run Apache HTTP Server and connect it to Tomcat? If I have to run Apache HTTP Server which mechanism do I have to connect it with tomcat? using Jk connector is the standard way? Do you recommend me to read http://tomcat.apache.org/connectors-doc/reference/apache.html ? I've found also http://tomcat.apache.org/connectors-doc/reference/apache.html but it seems to be outdated. Thanks for your response! Regards, Hernán