cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java ServerLifecycleListener.java

2003-03-14 Thread remm
remm2003/03/14 08:04:09

  Modified:catalina/src/share/org/apache/catalina/mbeans
MBeanFactory.java ServerLifecycleListener.java
  Log:
  - Revert all changes to 4.1.22.
  - Development should occur in the 5.0 branch, esp since 4.1.23 will happen
sooner rather than later.
  - Please verify to check that I'm not making any mistakes.
  
  Revision  ChangesPath
  1.43  +237 -175  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
  
  Index: MBeanFactory.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- MBeanFactory.java 11 Mar 2003 14:12:47 -  1.42
  +++ MBeanFactory.java 14 Mar 2003 16:04:08 -  1.43
  @@ -184,129 +184,6 @@
   
   
   /**
  - * Add Logger.
  - *
  - * @logger logger to be added
  - * @parent parent object name
  - * @host hostname object name for context logger
  - *
  - * @exception Exception if an MBean cannot be created or registered
  - */
  -private void addLogger(Logger logger, String parent, String hostname)
  -throws Exception {
  -
  -// Add the new instance to its parent component
  -ObjectName pname = new ObjectName(parent);
  -String type = pname.getKeyProperty(type);
  -Server server = ServerFactory.getServer();
  -if (type == null) {
  -ObjectName hname = new ObjectName(hostname);
  -String serviceName = hname.getKeyProperty(service);
  -Service service = server.findService(serviceName);
  -Engine engine = (Engine) service.getContainer();
  -Host host = (Host) engine.findChild(hname.getKeyProperty(host));
  -String name = pname.getKeyProperty(name);
  -String path = name.substring(name.lastIndexOf('/'));
  -String pathStr = getPathStr(path);
  -Context context = (Context) host.findChild(pathStr);
  -context.setLogger(logger);
  -} else {
  -String serviceName = pname.getKeyProperty(service);
  -Service service = server.findService(serviceName);
  -Engine engine = (Engine) service.getContainer();
  -if (type.equals(Engine)) {
  -engine.setLogger(logger);
  -} else if (type.equals(Host)) {
  -Host host = (Host) engine.findChild(pname.getKeyProperty(host));
  -host.setLogger(logger);
  -}
  -}
  -}
  -
  - 
  -/**
  - * Add Realm.
  - *
  - * @logger realm to be added
  - * @parent parent object name
  - * @host hostname object name for context realm
  - *
  - * @exception Exception if an MBean cannot be created or registered
  - */
  -private void addRealm(Realm realm, String parent, String hostname)
  -throws Exception {
  -
  -// Add the new instance to its parent component
  -ObjectName pname = new ObjectName(parent);
  -String type = pname.getKeyProperty(type);
  -Server server = ServerFactory.getServer();
  -if (type == null) {
  -ObjectName hname = new ObjectName(hostname);
  -String serviceName = hname.getKeyProperty(service);
  -Service service = server.findService(serviceName);
  -Engine engine = (Engine) service.getContainer();
  -Host host = (Host) engine.findChild(hname.getKeyProperty(host));
  -String name = pname.getKeyProperty(name);
  -String path = name.substring(name.lastIndexOf('/'));
  -String pathStr = getPathStr(path);
  -Context context = (Context) host.findChild(pathStr);
  -context.setRealm(realm);
  -} else {
  -String serviceName = pname.getKeyProperty(service);
  -Service service = server.findService(serviceName);
  -Engine engine = (Engine) service.getContainer();
  -if (type.equals(Engine)) {
  -engine.setRealm(realm);
  -} else if (type.equals(Host)) {
  -Host host = (Host) engine.findChild(pname.getKeyProperty(host));
  -host.setRealm(realm);
  -}
  -}
  -}
  -
  - 
  -/**
  - * Add Valve.
  - *
  - * @valve valve to be added
  - * @parent parent object name
  - * @host hostname object name for context realm
  - *
  - * @exception Exception if an MBean cannot be created or registered
  - */
  -private void addValve(Valve valve, String parent, String hostname)
  -throws Exception {
  -
  -// Add the new instance to its parent component
  -ObjectName pname 

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java ServerLifecycleListener.java

2003-03-12 Thread Costin Manolache
Amy Roh wrote:

 It makes sense to use different domain names instead of using service
 name.  It'll take lots of code change in admin to change all the
 objectnames to get rid of service name though.  *sigh*

I think a bit of grep can do the magic :-)

It's not a big hurry. I'll start changing the code that looks up objects
to use query instead of exact name - so it'll work in both cases. 
And probably I'll switch first in embed - which doesn't yet work with /admin
anyway ( since there is no Server and a lot of things are created
differently )
 
 Would it work if I have more than one service with the same host name
 and path because there is no way to distinguish between these two
 different contexts currently?  mbeans-descriptors.xml has all the

Sure. That's how load balancing would work.

The real issue about multiple engines in the same VM is management of
clusters. I don't plan to start 2 tomcats in the same VM ( but some people
may want to ), but to use a JMX proxy ( like the one that exposes mod_jk C
side as mbeans ) and have a sort of virtual tomcat instance.

The domain name is the key.

 components default to the same domain Catalina.  I wonder if bugzilla
 17749 is related to the problem.

The default in mbeans-descriptors should never be used ( and it shouldn't be
there in the first place ). As we move on with cleaning up the JMX
registration and make the component more JMX-aware - each component will
know its JMX domain and register childs in the same domain ( or locate other
components in the same domain ).

We just need to do it slowly.

Costin



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



Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java ServerLifecycleListener.java

2003-03-11 Thread Costin Manolache
[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.

I would do it in reverse - first tc5 and then backport.


Costin


   
   Revision  ChangesPath
   1.41  +11 -8
  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
   
   Index: MBeanFactory.java
   ===
   RCS file:
  
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
   retrieving revision 1.40 retrieving revision 1.41
   diff -u -r1.40 -r1.41
   --- MBeanFactory.java   19 Sep 2002 22:55:48 -  1.40
   +++ MBeanFactory.java   11 Mar 2003 03:25:52 -  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/ServerLifecycleListener.java
   
   Index: ServerLifecycleListener.java
   ===
   RCS file:
  
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java,v
   retrieving revision 1.37 retrieving revision 1.38
   diff -u -r1.37 -r1.38
   --- ServerLifecycleListener.java12 Feb 2003 22:11:27 -  1.37
   +++ ServerLifecycleListener.java11 Mar 2003 03:25:52 -  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]



Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java ServerLifecycleListener.java

2003-03-11 Thread Costin Manolache
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  ChangesPath
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 -  1.40
+++ MBeanFactory.java   11 Mar 2003 03:25:52 -  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.java12 Feb 2003 22:11:27 -
 1.37
+++ ServerLifecycleListener.java11 Mar 2003 03:25:52 -
 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]


cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java ServerLifecycleListener.java

2003-03-10 Thread amyroh
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.
  
  Revision  ChangesPath
  1.41  +11 -8 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
  
  Index: MBeanFactory.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- MBeanFactory.java 19 Sep 2002 22:55:48 -  1.40
  +++ MBeanFactory.java 11 Mar 2003 03:25:52 -  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/ServerLifecycleListener.java
  
  Index: ServerLifecycleListener.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- ServerLifecycleListener.java  12 Feb 2003 22:11:27 -  1.37
  +++ ServerLifecycleListener.java  11 Mar 2003 03:25:52 -  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]