Hi,
My web service wraps a command-line application that is rather resource
demanding. To manage the maximum number of instances that can run
concurrently, it uses a (custom) thread pool. This all works fine, but
my current thread pool is local to my service. Now that I have to
develop similar services, I would like to share the pool instead. I was
thinking of switching to Tomcat's Executor -
http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html - but
cannot find any examples on how to use it. Hopefully, someone can help
me with the following questions:
If I uncomment the corresponding lines in server.xml, can I then use the
default tomcatThreadPool by just instantiating
org.apache.catalina.core.StandardThreadExecutor?
Do I have to call start() and stop() on StandardThreadExecutor or is
this handled by Tomcat?
Is it possible to block on the execute() method of StandardThreadExecutor?
Can you only have one Executor per Connector?
My current thread pool uses java.util.concurrent.ExecutorService, which
allows to submit (execute) a Callable (instead of Runnable) task. This
is very convenient for returning the exit code of the command line
application to my Java code. It seems to me that this isn't possible
with StandardThreadExecutor or any other executor that implement the
|org.apache.catalina.Executor| interface?
Would it be appropriate to not use Tomcat's Executor and share my custom
thread pool among all services by using Tomcat's common/shared class loader?
CBy