Hello,

We are working on an application server that supports agents implementing
multiple kind of media APIs such as like Servlets, a telephone API, an SMS
API... To support web-applications, we naturally selected tomcat as our
servlet container.

Following is a bit of feedback on how we used the Catalina component model
for this, and the technical problems we faced and how we solved them. We
then propose to contribute an enhancement to the Catalina support for
embedded usages.


Our 100% java application server is built around a kernel layer that
controls low-level resources such as threads and file I/O. In addition,
servlet classes and resources are centrally stored in an external database
which is used by replicated instances of the server. During class loading,
on the fly verifications and rewriting is performed at the bytecode level.

Using the org.apache.catalina.startup.Embedded class, it has been easy to
integrate catalina in our application server. We provided a customized
ClassLoader manager to access to those resources (in addition, this
classloader performs bytecode checkings and rewriting).

>       Loader loader = createLoader (_agentLoader);
>       loader.setDelegate(true);
>       context.setLoader(loader);

We've also provided our own DirContext that extends BaseDirContext to
provide file access on the remote database.

>       ((StandardContext)context).setResources(new OurDirContext (...));

While the Embedded Class matched most of our needs and provided very nice
configuration points, the integration of our threading constraints was a
problem. Our application uses a specific Threading model, and all Servlet
must executed on our specific thread instances. In a first quick development
step we have patched our local copy of the
org.apache.catalina.connector.http.HttpConnector and XXX.HttpProcessor
classes, and more specifically modified the threadStart() method with the
code necessary to instanciate our own thread subclass instead of the plain
java.lang.Thread. However, we will run into maintenance problems as Jakarta
releases new versions of Catalina.

A nicer way to handle this problem would be to extend the factory model
already in place for ServerSockets to the domain of Threads, and hence
replace the duplicated code in HttpConnector.threadStart() and
HttpProcessor.threadStart() methods with the use of a ThreadFactory that can
be configured when tomcat is embedded. The factory would return a newly
allocated thread instance to use with HttpConnector or HttpProcessor. Does
anyone sees a better alternative to use 3rd party thread instances (both
HttpConnector and HttpProcessor are final classes and their threadStart()
method is private)?


Would there be an interest from the Catalina development community to
integrate such a ThreadFactory into Catalina if we contribute it along with
the patched HttpConnector Catalina sources.

Thanks for your help,

-------------------------
Sylvain ROULET
Eloquant
Tel: (+33) 6 17 08 46 01


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to