Well, there are 2 answers:

- with 4.1 and the current 5.0 - you need to get the "managedResource"
attribute, cast it to a Container/Server/Service and call the addListener
method with a direct call.  

- the "right way" for 5.0 would be to not use the lifecycle listener, but
JMX notifications. This is not yet implemented - and I don't consider it as 
a very high priority ( since there are more important issues ). But if
someone wants to help and write the code ( probably in LifecycleSupport )
to generate JMX notifications in addition to the regular callbacks - you'll
be able to add standard notification listeners using JMX API - and no 
tomcat-specific code. 

The missing piece is an easy way for modeler to generate notifications. I'm 
working on it - since it's also needed for the connector notifications.

BTW, I'm making progress with the JMX - I had some problems with the
registration/unregistration, things didn't fit well togheter - but I think
I found a simple solution. 

In case anyone is worried about the progress ( I am ) - things are pretty
close, there are many small details but I don't think the stability of the
code will be affected in any way. 


Costin


Filip Hanik wrote:

> I like that idea. So to help me out here, if I work with the service
> interface, there is no way for me to call "addLifecycleListener".
> So for a few simple questions,
> 1. how do I get the "server/service" object through JMX?
> 2. I could check using reflection if the addLifecycleListener method is
> available, but an interface would be nicer.
> 
> Filip
> 
> -----Original Message-----
> From: Costin Manolache [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 20, 2003 9:54 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Startup question
> 
> 
> A much better way - at least for tomcat5, but it should work for tomcat4 -
> is to use JMX. The server and service should be registered. We expose the
> "managedResource" attribute of type "Object" - you can cast it to the
> right type.
> 
> All you need is to know the object name of the server.
> 
> BTW, I would strongly suggest dealing with the Service - this way your
> code will work for embeded catalina ( for example jboss doesn't use
> Server, and AFAIK it is not required ).
> 
> Static methods are not very nice :-)
> 
> Costin



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

Reply via email to