RE: Startup question
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]
RE: Startup question
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]
Re: Startup question
Remy Maucherat wrote: > Filip Hanik wrote: >> yes, you are right, how do I subscribe to this event? >> I know that the server has a addLifeCycleListener, but how do I access >> the server from a cluster object for example? > > You can go up the tree, I think, but otherwise, you can just use > ServerFactory.getServer(). 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]
Re: Startup question
Would this work too? 1 - Create your own class which implements LifeCycleListener. 2 - Add it inside of like anything else. 3 - When LifeCycleListener.lifecycleEvent is called the LifecycleEvent has a method called getData() which returns an object refence which I hope is the reference to the Server. But use getType to determine if the event fired is the one you want. http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/host.html has the syntax for the Listener. Even though it is for Host - I speculate then smae concept applies to Server too. -Tim Remy Maucherat wrote: Filip Hanik wrote: yes, you are right, how do I subscribe to this event? I know that the server has a addLifeCycleListener, but how do I access the server from a cluster object for example? You can go up the tree, I think, but otherwise, you can just use ServerFactory.getServer(). Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Startup question
Filip Hanik wrote: yes, you are right, how do I subscribe to this event? I know that the server has a addLifeCycleListener, but how do I access the server from a cluster object for example? You can go up the tree, I think, but otherwise, you can just use ServerFactory.getServer(). Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Startup question
yes, you are right, how do I subscribe to this event? I know that the server has a addLifeCycleListener, but how do I access the server from a cluster object for example? Filip -Original Message- From: Tim Funk [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 3:37 PM To: Tomcat Developers List Subject: Re: Startup question I think o.a.catalina.core.StandardServer.start() fires the events you are looking for. -Tim org.apache.catalina.core Filip Hanik wrote: > hi there, > with the lifecycle events, can I get an event that Tomcat has started (ie, all the >contexts have been started)? > > if so, what event is that > > Filip > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Startup question
I think o.a.catalina.core.StandardServer.start() fires the events you are looking for. -Tim org.apache.catalina.core Filip Hanik wrote: hi there, with the lifecycle events, can I get an event that Tomcat has started (ie, all the contexts have been started)? if so, what event is that Filip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Startup question
hi there, with the lifecycle events, can I get an event that Tomcat has started (ie, all the contexts have been started)? if so, what event is that Filip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]