Pier, nice solution. Sort of a Servlet implementation of the adapter pattern. So
you're saying just make the service() method throw an exception, no questions
asked?
Also, you were quick to fire off about portability, and I agree, but when you work
in a WebLogic shop . . . Well, it has some nice features. :) I hope to discover
Tomcat's strengths as well in the near future, now that my company plans to use it
in a limited production role as well.
All, I would still be interested in hearing any other ideas on the "startup class"
problem.
-Erik
"Pier P. Fumagalli" wrote:
> Erik Weber at [EMAIL PROTECTED] wrote:
>
> > Hello all.
> >
> > I have minimal experience with Tomcat, and didn't see any mention of this in
> > looking over the docs.
> >
> > I am used to developing in WebLogic. WebLogic supports what are called startup
> > classes. You register the name of the class in the server's properties file,
> > and when the server starts, it instantiates that class with arguments included
> > in the properties file.
> >
> > I have found this is a nice way to start up asynchronous subscribers to a
> > messaging queue. Upon instantiation, which again is automatic, the various
> > subscribers, in their constructors, simply register themselves as listeners
> > with the queue.
> >
> > I was wondering if Tomcat supports a similar construct as this (startup
> > classes). If not, perhaps I could implement my queue subscribers as Servlets,
> > but this seems strange, considering mulitple threads should not be running
> > through a single subscriber.
> >
> > Any thoughts or advice on this?
>
> That's what you get when you rely on features specific to a specific Servlet
> container... My advice would be to use all your object as is, and have a
> servlet overriding the service() method throwing an HTTP error, and so use
> the init() and destroy() methods in that servlets to instantiate all your
> objects... You can use servlet properties to provide the class names and
> mimic the behavior of Weblogic, but then your web application will be
> portable to any compliant servlet container.
>
> Oh, and, of course, remember to initialize the servlet at startup :)
>
> Being "the" reference implementation, I wouldn't want to populate Tomcat's
> core with unportable features. If it runs under Tomcat, it runs everywhere
> :)
>
> Pier