diff src/main/java/alice/topology/node/IncomingConnectionInfo.java @ 647:e321c5ec9b58

fix toplogy manager; ring worked
author suruga
date Sun, 31 Dec 2017 19:32:27 +0900
parents 646f705e65b1
children
line wrap: on
line diff
--- a/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Sun Dec 31 12:06:45 2017 +0900
+++ b/src/main/java/alice/topology/node/IncomingConnectionInfo.java	Sun Dec 31 19:32:27 2017 +0900
@@ -13,35 +13,39 @@
     private String absName;
     private int count;
     private Logger log = Logger.getLogger(IncomingConnectionInfo.class);
+    private String managerKey;
 
-    public IncomingConnectionInfo(String absName, int count) {
+    public IncomingConnectionInfo(String absName, int count, String managerKey) {
         this.absName = absName;
         this.count = count;
+        this.managerKey = managerKey;
+        hostInfo.setKey(managerKey,absName);
     }
 
+
+
     @Override
     public void run() {
-        if (this.hostInfo.getVal() == null) {
+        HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
+        log.info(hostInfo.toString());
+        if ( hostInfo.name.equals("")) { // end case
+            log.info(" topology node finished " + absName);
             ods.put("local", "configNodeNum", count);
+            return ;
+        }
+        log.info("topology node " + absName + " will connect to " + hostInfo.name );
+        if (DataSegment.contains(hostInfo.connectionName)) {
+            // need to wait remove by DeleteConnection
+            ods.put("manager", absName, hostInfo);
         } else {
-            HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
-            log.info("topology node " + absName + " will connect to " + hostInfo.name );
-            if (DataSegment.contains(hostInfo.connectionName)) {
-                // need to wait remove by DeleteConnection
-                ods.put("manager", absName, hostInfo);
-            } else {
-                DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
-                ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
-                count++;
+            DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
+            ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
+            count++;
 
-                ods.put("cMember", hostInfo.connectionName);
-                new CreateConnectionList();
-            }
-
+            ods.put("cMember", hostInfo.connectionName);
+            new CreateConnectionList();
         }
-
-        IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, count);
-        cs.hostInfo.setKey(absName);
+        new IncomingConnectionInfo(absName, count, managerKey);
     }
 
 }