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/jk/java/org/apache/jk/common JkMX.java
Date Thu, 08 Aug 2002 18:19:53 GMT
costin      2002/08/08 11:19:53

  Modified:    jk/java/org/apache/jk/common JkMX.java
  Log:
  Proper shutdown of the JMX http adapter ( if loaded )
  
  Revision  Changes    Path
  1.5       +17 -3     jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkMX.java
  
  Index: JkMX.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkMX.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JkMX.java	24 Jul 2002 22:10:59 -0000	1.4
  +++ JkMX.java	8 Aug 2002 18:19:53 -0000	1.5
  @@ -119,13 +119,14 @@
       }
   
       /* ==================== Start/stop ==================== */
  -
  +    ObjectName serverName=null;
  +    
       /** Initialize the worker. After this call the worker will be
        *  ready to accept new requests.
        */
       public void loadAdapter() throws IOException {
           try {
  -            ObjectName serverName = new ObjectName("Http:name=HttpAdaptor");
  +            serverName = new ObjectName("Http:name=HttpAdaptor");
               mserver.createMBean("mx4j.adaptor.http.HttpAdaptor", serverName, null);
               if( host!=null ) 
                   mserver.setAttribute(serverName, new Attribute("Host", host));
  @@ -167,7 +168,7 @@
           try {
               Class c=Class.forName( "com.sun.jdmk.comm.HtmlAdaptorServer" );
               Object o=c.newInstance();
  -            ObjectName serverName=new ObjectName("Adaptor:name=html,port=" + port);
  +            serverName=new ObjectName("Adaptor:name=html,port=" + port);
               log.info("Registering the JMX_RI html adapter " + serverName);
               mserver.registerMBean(o,  serverName);
   
  @@ -180,6 +181,19 @@
               log.error( "Can't load the JMX_RI http adapter " + t.toString()  );
           }
       }
  +
  +    public void destroy() {
  +        try {
  +            log.info("Stoping JMX ");
  +
  +            if( serverName!=null ) {
  +                mserver.invoke(serverName, "stop", null, null);
  +            }
  +        } catch( Throwable t ) {
  +            log.error( "Destroy error", t );
  +        }
  +    }
  +
       public void init() throws IOException {
           try {
               mserver = DynamicMBeanProxy.getMBeanServer();
  
  
  

--
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