[jboss-cvs] JBoss Messaging SVN: r7315 - in trunk: src/main/org/jboss/messaging/core/remoting/server/impl and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 12 05:01:17 EDT 2009


Author: timfox
Date: 2009-06-12 05:01:17 -0400 (Fri, 12 Jun 2009)
New Revision: 7315

Modified:
   trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java
   trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerStartStopTest.java
Log:
management connector issue

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java	2009-06-12 08:30:50 UTC (rev 7314)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMRegistry.java	2009-06-12 09:01:17 UTC (rev 7315)
@@ -21,7 +21,6 @@
   */
 package org.jboss.messaging.core.remoting.impl.invm;
 
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -71,9 +70,4 @@
    {
       return this.acceptors.size();
    }
-   
-   public Map<Integer, InVMAcceptor> getAcceptors()
-   {
-      return acceptors;
-   }
 }

Modified: trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java	2009-06-12 08:30:50 UTC (rev 7314)
+++ trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java	2009-06-12 09:01:17 UTC (rev 7315)
@@ -144,56 +144,7 @@
       {
          return;
       }
-
-      // when JMX is enabled, it requires a INVM acceptor to send the core messages
-      // corresponding to the JMX management operations (@see ReplicationAwareStandardMBeanWrapper)
-      // we create one with a special negative id - this is a hack and instead, management should not use a connector to connect
-      if (config.isJMXManagementEnabled())
-      {
-         boolean alreadyConfigured = false;
-         for (TransportConfiguration config : transportConfigs)
-         {
-            if (config.getClass().getName().equals(InVMAcceptorFactory.class.getName()))
-            {
-               int serverID = 0;
-               if (config.getParams() != null)
-               {
-                  Integer iserverid = (Integer)config.getParams().get(TransportConstants.SERVER_ID_PROP_NAME);
-
-                  if (iserverid != null)
-                  {
-                     serverID = iserverid;
-                  }
-               }
-
-               if (serverID == managementConnectorID)
-               {
-                  alreadyConfigured = true;
-               }
-            }
-         }
-         if (!alreadyConfigured)
-         {
-            transportConfigs.add(new TransportConfiguration(InVMAcceptorFactory.class.getName(),
-                                                            new HashMap<String, Object>()
-                                                            {
-                                                               {
-                                                                  put(TransportConstants.SERVER_ID_PROP_NAME,
-                                                                      managementConnectorID);
-                                                               }
-                                                            }));
-         }
-      }
       
-      //Now we also need to create a invmacceptor with id 0 if it doesn't already exist - this is simple because
-      //lots of tests assume this - this requirement should also be removed
-      //this is a bad thing to do since does not play well when there are multiple servers in the same VM.
-      
-      if (InVMRegistry.instance.getAcceptor(0) == null)
-      {
-         transportConfigs.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      }
-
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
 
       for (TransportConfiguration info : transportConfigs)
@@ -218,6 +169,32 @@
             log.warn("Error instantiating acceptor \"" + info.getFactoryClassName() + "\"", e);
          }
       }
+      
+      //We now create a "special" acceptor used by management to send/receive management messages - this is an invm
+      //acceptor with a -ve server id
+      //TODO this is not the best solution, management should send/receive management messages direct.
+      //Remove this code when this is implemented without having to require a special acceptor
+      //https://jira.jboss.org/jira/browse/JBMESSAGING-1649
+      
+      if (config.isJMXManagementEnabled())
+      {
+         Map<String, Object> params = new HashMap<String, Object>();
+         
+         params.put(TransportConstants.SERVER_ID_PROP_NAME, managementConnectorID);
+         
+         AcceptorFactory factory = new InVMAcceptorFactory();
+         
+         Acceptor acceptor = factory.createAcceptor(params, bufferHandler, this, threadPool);
+         
+         acceptors.add(acceptor);
+         
+         if (managementService != null)
+         {
+            TransportConfiguration info = new TransportConfiguration(InVMAcceptorFactory.class.getName(), params);
+            
+            managementService.registerAcceptor(acceptor, info);
+         }         
+      }
 
       for (Acceptor a : acceptors)
       {

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-06-12 08:30:50 UTC (rev 7314)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-06-12 09:01:17 UTC (rev 7315)
@@ -200,6 +200,7 @@
    
    private static AtomicInteger managementConnectorSequence = new AtomicInteger(0);
    
+
    // Constructors
    // ---------------------------------------------------------------------------------
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerStartStopTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerStartStopTest.java	2009-06-12 08:30:50 UTC (rev 7314)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerStartStopTest.java	2009-06-12 09:01:17 UTC (rev 7315)
@@ -102,6 +102,8 @@
          stop();
       }
       
+      start();
+      
       JBossConnectionFactory jbcf = new JBossConnectionFactory(new TransportConfiguration(NettyConnectorFactory.class.getCanonicalName()));
       
       jbcf.setBlockOnPersistentSend(true);
@@ -129,6 +131,8 @@
       conn.close();
       
       jbcf.close();
+      
+      stop();
    }
 
    // Package protected ---------------------------------------------




More information about the jboss-cvs-commits mailing list