Mercurial > hg > Database > Christie
comparison src/main/java/christie/topology/manager/CreateTreeTopology.java @ 85:331ad549e764
fix CreateTreeTopology
author | akahori |
---|---|
date | Sat, 15 Sep 2018 10:22:12 +0900 |
parents | 2314c55534ef |
children | f607fe2fc9a9 |
comparison
equal
deleted
inserted
replaced
84:c0c29f989af3 | 85:331ad549e764 |
---|---|
54 if (hostCount == 0) { | 54 if (hostCount == 0) { |
55 // どこにも繋がれるところがないので, ルートのとき. | 55 // どこにも繋がれるところがないので, ルートのとき. |
56 // ルートなので, connectNodeNumもreverseCountも0でいい. | 56 // ルートなので, connectNodeNumもreverseCountも0でいい. |
57 getDGM(nodeName).put("connectNodeNum", 0); | 57 getDGM(nodeName).put("connectNodeNum", 0); |
58 getDGM(nodeName).put("reverseCount", 0); | 58 getDGM(nodeName).put("reverseCount", 0); |
59 getLocalDGM().put("start", true); | |
60 | 59 |
61 } else { | 60 } else { |
62 // 親のみにつながればいいので1 | 61 // 親のみにつながればいいので1 |
63 getDGM(nodeName).put("connectNodeNum", 1); | 62 getDGM(nodeName).put("connectNodeNum", 1); |
64 // put parent information own | 63 // put parent information own |
65 String parentNodeName = parentManager.getMyParent(); | 64 String parentNodeName = parentManager.getMyParent(); |
66 HostMessage parent = nameTable.get(parentNodeName); | 65 HostMessage parent = nameTable.get(parentNodeName); |
67 int num = parentManager.getMyNumber(); | 66 int num = parentManager.getMyNumber(); |
68 | 67 |
69 HostMessage newHost = new HostMessage(parent.hostName, parent.port, "parent", "child" + num); | 68 HostMessage newParentHost = new HostMessage(parent.hostName, parent.port, "parent", "child" + num); |
70 newHost.nodeName = parentNodeName; | 69 newParentHost.nodeName = parentNodeName; |
71 newHost.remoteNodeName = nodeName; // address | 70 newParentHost.remoteNodeName = nodeName; // address |
72 | 71 |
73 getLocalDGM().put("nodeInfo", newHost); | 72 getLocalDGM().put("nodeInfo", newParentHost); |
74 cgm.setup(new RecordTopology()); | 73 cgm.setup(new RecordTopology()); |
75 | 74 |
76 // put own information parent | 75 // put own information parent |
77 newHost = new HostMessage(newHost.hostName, newHost.port, "child" + num, "parent"); | 76 HostMessage newChildHost = new HostMessage(newHost.hostName, newHost.port, "child" + num, "parent"); |
78 newHost.nodeName = nodeName; | 77 newChildHost.nodeName = nodeName; |
79 newHost.remoteNodeName = parentNodeName; | 78 newChildHost.remoteNodeName = parentNodeName; |
80 | 79 |
81 getLocalDGM().put("nodeInfo", newHost); | 80 getLocalDGM().put("nodeInfo", newChildHost); |
82 cgm.setup(new RecordTopology()); | 81 cgm.setup(new RecordTopology()); |
83 } | 82 } |
83 | |
84 getDGM(nodeName).put("start", "start"); | |
85 | |
84 } | 86 } |
85 } | 87 } |