Mercurial > hg > Database > Alice
comparison src/main/java/alice/topology/fix/FixTopology.java @ 496:f82f259ea93b dispose
putConnectionInfo only called from keepAlive deamon
author | sugi |
---|---|
date | Fri, 12 Dec 2014 05:29:31 +0900 |
parents | 24e535123df7 |
children | 5adb0f530e3d |
comparison
equal
deleted
inserted
replaced
495:b789b8459996 | 496:f82f259ea93b |
---|---|
13 | 13 |
14 public class FixTopology extends CodeSegment { | 14 public class FixTopology extends CodeSegment { |
15 | 15 |
16 private Receiver info = ids.create(CommandType.TAKE); // disconnection nodeInfo | 16 private Receiver info = ids.create(CommandType.TAKE); // disconnection nodeInfo |
17 private Receiver info1 = ids.create(CommandType.TAKE); // all connection Info | 17 private Receiver info1 = ids.create(CommandType.TAKE); // all connection Info |
18 private Receiver info2 = ids.create(CommandType.TAKE); // node count | |
19 private Receiver info3 = ids.create(CommandType.TAKE); // IP Table | 18 private Receiver info3 = ids.create(CommandType.TAKE); // IP Table |
20 private Receiver info4 = ids.create(CommandType.TAKE); // parentManager | 19 private Receiver info4 = ids.create(CommandType.TAKE); // parentManager |
21 | 20 |
22 public FixTopology() { | 21 public FixTopology() { |
23 info.setKey("_DISCONNECTNODE"); | 22 info.setKey("_DISCONNECTNODE"); |
24 info1.setKey("topology"); | 23 info1.setKey("topology"); |
25 info2.setKey("hostCount"); | |
26 info3.setKey("nameTable"); | 24 info3.setKey("nameTable"); |
27 info4.setKey("parentManager"); | 25 info4.setKey("parentManager"); |
28 } | 26 } |
29 | 27 |
30 @SuppressWarnings("unchecked") | 28 @SuppressWarnings("unchecked") |
49 | 47 |
50 if (lostNode!=null && lostNode.isAlive()) { | 48 if (lostNode!=null && lostNode.isAlive()) { |
51 // change state not Alive | 49 // change state not Alive |
52 lostNode.alive = false; | 50 lostNode.alive = false; |
53 // get lastJoinedNode | 51 // get lastJoinedNode |
54 int last = info2.asInteger()-1; | 52 String lastJoinNodeName = manager.getLastNode().getName(); |
55 String lastJoinNodeName = "node"+last; | |
56 LinkedList<HostMessage> connectionList = topology.get(lastJoinNodeName); | 53 LinkedList<HostMessage> connectionList = topology.get(lastJoinNodeName); |
57 // lastJoinedNode has one connection | 54 // lastJoinedNode has one connection |
58 HostMessage parentNode = connectionList.poll(); | 55 HostMessage parentNode = connectionList.poll(); |
59 Parent p = manager.find(parentNode.absName); | 56 Parent p = manager.find(parentNode.absName); |
60 p.decrement(); | 57 p.decrement(); |
130 } else { | 127 } else { |
131 // disconnect message already received. | 128 // disconnect message already received. |
132 } | 129 } |
133 | 130 |
134 ods.put(info1.key, topology); | 131 ods.put(info1.key, topology); |
135 ods.put(info2.key, info2.getReceiveData()); | |
136 ods.put(info3.key, nameTable); | 132 ods.put(info3.key, nameTable); |
137 ods.put(info4.key, manager); | 133 ods.put(info4.key, manager); |
138 } | 134 } |
139 } | 135 } |