changeset 497:5adb0f530e3d dispose

bug fix
author sugi
date Mon, 15 Dec 2014 16:41:08 +0900
parents f82f259ea93b
children e5d2141af6c2
files src/main/java/alice/topology/fix/FixTopology.java src/main/java/alice/topology/manager/ParentManager.java
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/alice/topology/fix/FixTopology.java	Fri Dec 12 05:29:31 2014 +0900
+++ b/src/main/java/alice/topology/fix/FixTopology.java	Mon Dec 15 16:41:08 2014 +0900
@@ -53,8 +53,6 @@
             LinkedList<HostMessage> connectionList = topology.get(lastJoinNodeName);
             // lastJoinedNode has one connection
             HostMessage parentNode = connectionList.poll();
-            Parent p =  manager.find(parentNode.absName);
-            p.decrement();
 
             connectionList = topology.get(parentNode.absName);
             for (HostMessage node1 : connectionList) {
@@ -85,8 +83,6 @@
                                 node1.port = lastJoinNode.port;
                                 node1.absName = lastJoinNodeName;
                                 ods.put(node1.remoteAbsName, node1);
-                                p = manager.find(lastJoinNodeName);
-                                p.increment();
                                 break;
                             }
                         }
@@ -112,6 +108,17 @@
                 manager.remove(lostNodeName);
             }
 
+            for (Parent p1 : manager.getList()) {
+                LinkedList<HostMessage> list = topology.get(p1.getName());
+                int child = 0;
+                for (HostMessage h : list) {
+                    if (!"parent".equals(h.connectionName)) {
+                        child++;
+                    }
+                }
+                p1.setChildren(child);
+            }
+
             // need debug option
             for (LinkedList<HostMessage> list :topology.values()){
                 if (list.size() !=0) {
--- a/src/main/java/alice/topology/manager/ParentManager.java	Fri Dec 12 05:29:31 2014 +0900
+++ b/src/main/java/alice/topology/manager/ParentManager.java	Mon Dec 15 16:41:08 2014 +0900
@@ -84,4 +84,8 @@
             counter++;
         }
     }
+
+    public LinkedList<Parent> getList() {
+        return list;
+    }
 }