comparison src/main/java/christie/topology/manager/SearchHostName.java @ 64:f884c1bd0d36

fix IncomingHosts and RecordTopology. and refactor.
author akahori
date Thu, 30 Aug 2018 10:55:37 +0900
parents cfd79a71f9cd
children 7abfe041b75c
comparison
equal deleted inserted replaced
63:c73bb6a17034 64:f884c1bd0d36
32 32
33 33
34 // Question: remove処理 どうしようか. いらない気もする. 34 // Question: remove処理 どうしようか. いらない気もする.
35 // DataSegment.remove(hostInfo.absName); 35 // DataSegment.remove(hostInfo.absName);
36 36
37 cgm.createRemoteDGM(reconnectHost.absName, reconnectHost.hostName, reconnectHost.port); 37 cgm.createRemoteDGM(reconnectHost.nodeName, reconnectHost.hostName, reconnectHost.port);
38 getDGM(reconnectHost.absName).put("host", reconnectHost.absName); 38 getDGM(reconnectHost.nodeName).put("host", reconnectHost.nodeName);
39 39
40 // put Host dataSegment on reconnect node 40 // put Host dataSegment on reconnect node
41 if (topology.containsKey(reconnectHost.absName)) { 41 if (topology.containsKey(reconnectHost.nodeName)) {
42 42
43 // Question: これはバグ...? 43 // Question: これはバグ...?
44 // ods.put(reconnectHost.absName, "dummy"); // this is bug 44 // ods.put(reconnectHost.absName, "dummy"); // this is bug
45 45
46 if (running){ 46 if (running){
47 getLocalDGM().put(reconnectHost.absName, ValueFactory.createNilValue()); 47 getLocalDGM().put(reconnectHost.nodeName, ValueFactory.createNilValue());
48 } 48 }
49 49
50 50
51 LinkedList<HostMessage> hostList = topology.get(reconnectHost.absName); 51 LinkedList<HostMessage> hostList = topology.get(reconnectHost.nodeName);
52 for (HostMessage host : hostList){ 52 for (HostMessage host : hostList){
53 getLocalDGM().put(reconnectHost.absName, host); 53 getLocalDGM().put(reconnectHost.nodeName, host);
54 System.out.println("put data in "+ reconnectHost.absName); 54 System.out.println("put data in "+ reconnectHost.nodeName);
55 } 55 }
56 } 56 }
57 57
58 // update topology information 58 // update topology information
59 for (LinkedList<HostMessage> list :topology.values()){ 59 for (LinkedList<HostMessage> list :topology.values()){
60 for (HostMessage host : list){ 60 for (HostMessage host : list){
61 61
62 // find and update old info 62 // find and update old info
63 if (!reconnectHost.absName.equals(host.absName)) continue; 63 if (!reconnectHost.nodeName.equals(host.nodeName)) continue;
64 64
65 if (!reconnectHost.hostName.equals(host.hostName) || reconnectHost.port != host.port){ 65 if (!reconnectHost.hostName.equals(host.hostName) || reconnectHost.port != host.port){
66 host.hostName = reconnectHost.hostName; 66 host.hostName = reconnectHost.hostName;
67 host.port = reconnectHost.port; 67 host.port = reconnectHost.port;
68 68
69 getLocalDGM().put(host.remoteAbsName, host); 69 getLocalDGM().put(host.remoteNodeName, host);
70 70
71 } else { 71 } else {
72 // nothing to do ? 72 // nothing to do ?
73 } 73 }
74 } 74 }
75 } 75 }
76 76
77 for (LinkedList<HostMessage> list :topology.values()){ 77 for (LinkedList<HostMessage> list :topology.values()){
78 System.out.print(list.get(0).remoteAbsName+" : "); 78 System.out.print(list.get(0).remoteNodeName+" : ");
79 for (HostMessage host : list){ 79 for (HostMessage host : list){
80 System.out.print("[ "+host.absName+" "+host.hostName+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); 80 System.out.print("[ "+host.nodeName+" "+host.hostName+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteNodeName+" ]");
81 } 81 }
82 System.out.println(); 82 System.out.println();
83 } 83 }
84 } 84 }
85 85