tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/mx DynamicMBeanProxy.java
Date Thu, 03 Oct 2002 19:34:47 GMT
costin      2002/10/03 12:34:47

  Modified:    util/java/org/apache/tomcat/util/mx DynamicMBeanProxy.java
  Log:
  A fix in the object name ( ',' needs to be used as separator ).
  Also added unregister - need for reloads.
  
  Revision  Changes    Path
  1.7       +19 -5     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/mx/DynamicMBeanProxy.java
  
  Index: DynamicMBeanProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/mx/DynamicMBeanProxy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DynamicMBeanProxy.java	18 Sep 2002 11:03:06 -0000	1.6
  +++ DynamicMBeanProxy.java	3 Oct 2002 19:34:47 -0000	1.7
  @@ -129,10 +129,10 @@
           } else {
               instances.put( name, new Integer( 0 ));
           }
  -        return "name=" + name + " seq=" + seq;
  +        return "name=" + name + ",seq=" + seq;
       }
   
  -    public static void createMBean( Object proxy, String domain, String name ) {
  +    public static String createMBean( Object proxy, String domain, String name ) {
           try {
               DynamicMBeanProxy mbean=new DynamicMBeanProxy();
               mbean.setReal( proxy );
  @@ -142,24 +142,38 @@
                   mbean.setName( generateName( proxy.getClass() ));
               }
   
  -            mbean.registerMBean( domain );
  +            return mbean.registerMBean( domain );
           } catch( Throwable t ) {
               log.error( "Error creating mbean ", t );
  +            return null;
           }
       }
       
  -    public void registerMBean( String domain ) {
  +    public String registerMBean( String domain ) {
           try {
               // XXX use aliases, suffix only, proxy.getName(), etc
  -            ObjectName oname=new ObjectName( domain + ": " +  getName());
  +            String fullName=domain + ": " +  getName();
  +            ObjectName oname=new ObjectName( fullName );
   
               if(  getMBeanServer().isRegistered( oname )) {
                   log.info("Unregistering " + oname );
                   getMBeanServer().unregisterMBean( oname );
               }
               getMBeanServer().registerMBean( this, oname );
  +            return fullName;
           } catch( Throwable t ) {
               log.error( "Error creating mbean ", t );
  +            return null;
  +        }
  +    }
  +
  +    public static void unregisterMBean( Object o, String name ) {
  +        try {
  +            ObjectName oname=new ObjectName( name );
  +
  +            getMBeanServer().unregisterMBean( oname );
  +        } catch( Throwable t ) {
  +            log.error( "Error unregistering mbean ", t );
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message