User: norbert 
  Date: 00/06/14 12:16:53

  Modified:    src/java/org/spydermq/server Main.java
  Log:
  Add some JMX instrumentation
  change the jnp server
  add a mutex object for a better synchronization
  
  Revision  Changes    Path
  1.6       +33 -7     spyderMQ/src/java/org/spydermq/server/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/server/Main.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Main.java 2000/06/10 00:01:26     1.5
  +++ Main.java 2000/06/14 19:16:52     1.6
  @@ -30,6 +30,12 @@
   import java.io.FileInputStream;
   import java.util.StringTokenizer;
   
  +import javax.management.*;
  +import java.net.*;
  +import javax.management.loading.*;
  +import java.util.Set;
  +import java.util.Iterator;
  +
   /**
    *   A simple JMS server
    *  This class is meant to be extended by specific server wanting JMS services
  @@ -37,7 +43,7 @@
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    *   @author Rich Johns ([EMAIL PROTECTED])
    *
  - *   @version $Revision: 1.5 $
  + *   @version $Revision: 1.6 $
    */
   public class Main implements Runnable
   {
  @@ -48,10 +54,7 @@
        DistributedJMSServer theDistributedServer;
        SecurityManager securityManager;
        JMSServer theServer;
  -
  -     //We prevent garbage collection with a static variable
  -     //MF FIXME: use JMX to admin and prevent garbage collectionf
  -     private static Main thisServer;
  +     MBeanServer mBeanServer;
   
        //DEBUG -- For the RemoteControl object
        private static RemoteControlImpl remoteControl;
  @@ -85,7 +88,30 @@
                                Log.notice("[Warning]: SpyderMQ.properties specifys 
NOT to start a JNDI Server.");
                                Log.notice("           If a JNDI Server is not running 
SpyderMQ will not start.");
                        }
  +                     
  +                     //Create an MBeanServer
  +                     mBeanServer = new MBeanServer();                        
   
  +                     // Create MLet
  +                     MLet mlet = new MLet();
  +                     mBeanServer.registerMBean(mlet, new 
ObjectName(mBeanServer.getDefaultDomain(), "service", "MLet"));
  +                              
  +                     // Set MLet as classloader for this app
  +                     Thread.currentThread().setContextClassLoader(mlet);
  +
  +                     // Read default configuration
  +                     URL mletConf = 
getClass().getClassLoader().getResource("spyderMQ.plugin");
  +                     Set beans = (Set)mlet.getMBeansFromURL(mletConf);
  +                     Iterator enum = beans.iterator();
  +                     while (enum.hasNext())
  +                     {
  +                        Object obj = enum.next();
  +                        if (obj instanceof Exception) Log.error(obj);
  +                     }
  +
  +                     //Start the adaptor
  +                     mBeanServer.invoke(new 
ObjectName("Adaptor:name=html,port=8082"), "start", new Object[0], new String[0]);
  +                     
                        //Get an InitialContext
                        InitialContext ctx=new InitialContext();
   
  @@ -96,6 +122,7 @@
                        theServer = new JMSServer(securityManager);
                        theDistributedServer = 
JMSServerFactory.createJMSServer(theServer,cfg);
                        String 
connectionReceiverCN=(String)cfg.get("ConnectionReceiverClassName");
  +                     mBeanServer.registerMBean(theServer, new 
ObjectName(JMSServer.OBJECT_NAME));
                
                        //Get the Topic properties
                        String 
topicConnectionFactoryCN=(String)cfg.get("DistributedTopicConnectionFactoryClassName");
  @@ -201,8 +228,7 @@
        
        public static void main(String[] args) throws Exception
        {    
  -             thisServer = new Main();
  -             thisServer.run();
  +             new Main().run();
        }
        
   }
  
  
  

Reply via email to