# HG changeset patch # User sugi # Date 1418102757 -32400 # Node ID 9a7dd7591ddc3a3b6216bf5fde1f948224a09290 # Parent 7ef0ebb40c9b71f9cbd12393ecce030239d6056f bug fix diff -r 7ef0ebb40c9b -r 9a7dd7591ddc src/main/java/alice/topology/fix/FixTopology.java --- a/src/main/java/alice/topology/fix/FixTopology.java Mon Dec 08 23:11:26 2014 +0900 +++ b/src/main/java/alice/topology/fix/FixTopology.java Tue Dec 09 14:25:57 2014 +0900 @@ -8,6 +8,7 @@ import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.topology.HostMessage; +import alice.topology.manager.Parent; import alice.topology.manager.ParentManager; public class FixTopology extends CodeSegment { @@ -65,10 +66,7 @@ } if (!lastJoinNodeName.equals(lostNodeName)) { - - if (lostNodeName.equals(parentNode.remoteAbsName)) { - - } else { + if (!lostNodeName.equals(parentNode.remoteAbsName)) { // send close message to lastJoinedNode ods.put(lastJoinNodeName, "_CLOSEMESSEAGE", parentNode.reverseName); // send close message to lastJoinedNode's parent @@ -103,29 +101,34 @@ break; } } + } } disconnectionList.clear(); manager.replaceAndRemove(lostNodeName, lastJoinNodeName); } else { // disconnection node is lastJoinedNode + Parent p = manager.find(parentNode.absName); + p.decrement(); manager.remove(lostNodeName); } + + // need debug option + for (LinkedList list :topology.values()){ + if (list.size() !=0) { + System.out.print(list.get(0).remoteAbsName+" : "); + for (HostMessage host : list){ + System.out.print("[ "+host.absName+" "+host.name+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); + } + System.out.println(); + } + } + + manager.show(); } else { // disconnect message already received. } - // need debug option - for (LinkedList list :topology.values()){ - if (list.size() !=0) { - System.out.print(list.get(0).remoteAbsName+" : "); - for (HostMessage host : list){ - System.out.print("[ "+host.absName+" "+host.name+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); - } - System.out.println(); - } - } - ods.put(info1.key, topology); ods.put(info2.key, info2.getReceiveData()); ods.put(info3.key, nameTable); diff -r 7ef0ebb40c9b -r 9a7dd7591ddc src/main/java/alice/topology/manager/ParentManager.java --- a/src/main/java/alice/topology/manager/ParentManager.java Mon Dec 08 23:11:26 2014 +0900 +++ b/src/main/java/alice/topology/manager/ParentManager.java Tue Dec 09 14:25:57 2014 +0900 @@ -54,11 +54,7 @@ list.remove(removeNode); } - public void decrementChild(String name) { - list.get(position).decrement(); - } - - private Parent find(String name) { + public Parent find(String name) { boolean found = false; int i = 0; for (;i