>
> >>>> 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.
> >>
> >> Can you not import the application Jars and just interact with them
> >> directly then?  Why do you have to interact with it via system process?
> >>
> >
> > If I do that, due to glpk is not threadsafe, a call to a method can crash
> > tomcat.
>
> I don't know what glpk does, can you explain?


glpk is a gnu library to solving some kind of mathematical problems
http://www.gnu.org/software/glpk/

You can use the library in c, and there exist wrappers for java, python and
other programming languages



>
> I think you may be over thinking the thread safety issue.
>
> If multiple threads can't access the instances of the thing, thread
> safety is not an issue.
>
> If the entire code block was instantiated inside a Servlet doGet
> method with no external exposure or external scope, there is no
> problem.
>
> Do you know why it is not thread safe?
>

I know about some problems related to process memory
allocation/deallocation because I've experienced them. The documentation
says that is not thread safe.

Why do you think that I'm over thinking thread safety issue?

Reply via email to