Hello,

I would like to revive the discussion of Avalon-Servlet relations.

[Apologies for the crosspost.]

Previous discussion:
http://marc.theaimsgroup.com/?t=100811389300002&r=1&w=2

There seem to be two competing styles for using Avalon in a Servlet
environment (or using Servlets in an Avalon environment).

Style 1: Use the init() method of an initialization Servlet to create 
a ComponentManager (or ContainerManager, once the system package is 
stable) and place it in the ServletContext for your webapp. Use the
destroy() method of the initialization Servlet to dispose the 
ComponentManager/ContainerManager.

Style 2: Run your components inside of Phoenix and make them available
as a service which can be accessed via a socket connection using your
protocol of choice. Your servlets talk to your Phoenix service(s) via
socket connections.

We (Leif and I) have thus far used Style 1, since it is far simpler 
to get started. But now we are running into problems, because there
are no guarantees of the order in which the servlets will be destroyed,
so it is possible that the initialization Servlet (and thus the 
ComponentManager/ContainerManager) will be destroyed before the 
others.

In the Servlet 2.3 spec this kind of thing can be handled using
ServletContextListeners which listen for webapp startup and shutdown
events. So you would just implement a SCL which does the same thing
as the initialization Servlet mentioned above.

But this is not an option for Servlet 2.2 containers, like Jo!,
our servlet container of choice. We really don't want to go back
to the painful horror of Tomcat just to get this.

I'm still not too stoked about Style 2, though, since it seems like a 
lot of work and I am lazy.

Fortunately, Jo! can be run as a Phoenix block, which perhaps opens up
other possibilities. However, I know very little about how Phoenix
actually works at this point, so I'm not sure if what I have in mind 
is workable.

Basically, I want to create a Server Application with just two blocks,
MyBlock and Jo. MyBlock depends on Jo. MyBlock sets up a ComponentManager
or ContainerManager and stores it in a JNDI tree, then calls the deployWar
method of the Jo block. At Phoenix shutdown MyBlock calls undeployWar
and then disposes the ComponentManager/ContainerManager.

Does this make sense? Thoughts? Better ideas?

Thanks for reading,

Ryan








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

Reply via email to