Amy Roh wrote: >> [EMAIL PROTECTED] wrote: >> >> > amyroh 2003/03/10 19:25:52 >> > >> > Modified: catalina/src/share/org/apache/catalina/mbeans >> > MBeanFactory.java ServerLifecycleListener.java >> > Log: >> > Set to use JSR77 names as default. >> >> Please make sure tomcat 5 is also updated. > > Of course I was planning to do so. ;-) > > Question: > Is there a way to get the service name from jsr77 context name? > Currently, it's not included in its object name
We could expose it as an attribute if you need it ( short term ). Don't ask me - I didn't wrote JSR77, just implemented it for tomcat :-) The service name should just go away - we should stop using it in all names. The DOMAIN in the JMX name should be identical with the Engine name and the service name. The only purpose of service name is to allow multiple tomcat instances in the same JVM. The only sane way to support this is by using a different JMX domain name for different instances. In particular ( if you look at the mod_jk proxy ) it should be possible to create proxies for remote tomcat instances - they would appear in the JMX space as if they were engines in the same VM, so admin could work on a whole cluster ( well, not easily - but doable ). Having a Service name that is different from the Engine name doesn't make sense IMO, it just creates confusion. Given that Service is not used in Embeded, the name of the service shouldn't even matter - no code should ever care or touch Server or Service interfaces, since the code would break in Embeded. The only use of Service and Server should be in standalone, when starting tomcat. BTW, the use of the static field and ServerFactory is pretty bad IMO - in tomcat5 at least we should just use JMX and get the server by name ( using the domain name of the current component, and the defined name of the component ). For now - just avoid using the Server/Service where you can, and assume a single name will be used - and it'll match the domain name. Costin > > Thanks, > Amy > >> >> I would do it in reverse - first tc5 and then backport. >> >> >> Costin >> >> >> > >> > Revision Changes Path >> > 1.41 +11 -8 >> > >> > jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactor > y.java >> > >> > Index: MBeanFactory.java >> > =================================================================== >> > RCS file: >> > >> > /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/M > BeanFactory.java,v >> > retrieving revision 1.40 retrieving revision 1.41 >> > diff -u -r1.40 -r1.41 >> > --- MBeanFactory.java 19 Sep 2002 22:55:48 -0000 1.40 >> > +++ MBeanFactory.java 11 Mar 2003 03:25:52 -0000 1.41 >> > @@ -1227,13 +1227,16 @@ >> > * >> > * @exception Exception if a component cannot be removed >> > */ >> > - public void removeContext(String name) throws Exception { >> > + public void removeContext(String name, String pname) throws >> > Exception { >> > >> > // Acquire a reference to the component to be removed >> > ObjectName oname = new ObjectName(name); >> > - String serviceName = oname.getKeyProperty("service"); >> > - String hostName = oname.getKeyProperty("host"); >> > - String contextName = > getPathStr(oname.getKeyProperty("path")); >> > + ObjectName poname = new ObjectName(pname); >> > + String serviceName = poname.getKeyProperty("service"); >> > + String hostName = poname.getKeyProperty("host"); >> > + String pathname = oname.getKeyProperty("name"); >> > + String path = pathname.substring(pathname.lastIndexOf('/')); >> > + String contextName = getPathStr(path); >> > Server server = ServerFactory.getServer(); >> > Service service = server.findService(serviceName); >> > Engine engine = (Engine) service.getContainer(); >> > >> > >> > >> > 1.38 +5 -4 >> > >> > jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ServerLifec > ycleListener.java >> > >> > Index: ServerLifecycleListener.java >> > =================================================================== >> > RCS file: >> > >> > /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/S > erverLifecycleListener.java,v >> > retrieving revision 1.37 retrieving revision 1.38 >> > diff -u -r1.37 -r1.38 >> > --- ServerLifecycleListener.java 12 Feb 2003 22:11:27 -0000 > 1.37 >> > +++ ServerLifecycleListener.java 11 Mar 2003 03:25:52 -0000 > 1.38 >> > @@ -367,6 +367,7 @@ >> > >> > try { >> > >> > + setJsr77Names(true); >> > MBeanFactory factory = new MBeanFactory(); >> > createMBeans(factory); >> > createMBeans(ServerFactory.getServer()); >> >> >> >> --------------------------------------------------------------------- >> 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]