[hornetq-commits] JBoss hornetq SVN: r10925 - branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 5 12:45:01 EDT 2011


Author: borges
Date: 2011-07-05 12:45:00 -0400 (Tue, 05 Jul 2011)
New Revision: 10925

Modified:
   branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
Log:
HORNETQ-720 Notify node up to update topology.

Modified: branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
===================================================================
--- branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java	2011-07-05 16:10:20 UTC (rev 10924)
+++ branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java	2011-07-05 16:45:00 UTC (rev 10925)
@@ -143,16 +143,9 @@
             {
                NodeAnnounceMessage msg = (NodeAnnounceMessage)packet;
 
-               Pair<TransportConfiguration, TransportConfiguration> pair;
-               if (msg.isBackup())
-               {
-                  pair = new Pair<TransportConfiguration, TransportConfiguration>(null, msg.getConnector());
-               }
-               else
-               {
-                  pair = new Pair<TransportConfiguration, TransportConfiguration>(msg.getConnector(), null);
-               }
-               server.getClusterManager().notifyNodeUp(msg.getNodeID(), pair, false, true);
+               server.getClusterManager().notifyNodeUp(msg.getNodeID(),
+                                                       getPairForNotification(msg.getConnector(), msg.isBackup()),
+                                                       false, true);
             }
             else if (packet.getType() == PacketImpl.HA_BACKUP_REGISTRATION)
             {
@@ -169,8 +162,21 @@
                   e.printStackTrace();
                   throw new RuntimeException(e);
                }
+               server.getClusterManager().notifyNodeUp(msg.getNodeID(),
+                                                       getPairForNotification(msg.getConnector(), true), false, true);
             }
          }
+
+         private
+                  Pair<TransportConfiguration, TransportConfiguration>
+                  getPairForNotification(TransportConfiguration conn, boolean isBackup)
+         {
+            if (isBackup)
+            {
+               return new Pair<TransportConfiguration, TransportConfiguration>(null, conn);
+            }
+            return new Pair<TransportConfiguration, TransportConfiguration>(conn, null);
+         }
       });
 
 
@@ -178,12 +184,12 @@
       return entry;
    }
 
-   public ServerSessionPacketHandler getSessionHandler(final String sessionName)
+   ServerSessionPacketHandler getSessionHandler(final String sessionName)
    {
       return sessionHandlers.get(sessionName);
    }
 
-   public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
+   void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
    {
       sessionHandlers.put(name, handler);
    }



More information about the hornetq-commits mailing list