changeset 93:7abfe041b75c

update HostMessage del reverseKey
author akahori
date Sat, 15 Sep 2018 17:41:14 +0900
parents f607fe2fc9a9
children 87a203c99177
files src/main/java/christie/topology/HostMessage.java src/main/java/christie/topology/manager/CreateTreeTopology.java src/main/java/christie/topology/manager/FileParser.java src/main/java/christie/topology/manager/IncomingHosts.java src/main/java/christie/topology/manager/SearchHostName.java
diffstat 5 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/christie/topology/HostMessage.java	Sat Sep 15 11:27:36 2018 +0900
+++ b/src/main/java/christie/topology/HostMessage.java	Sat Sep 15 17:41:14 2018 +0900
@@ -11,7 +11,6 @@
     public String connectionName;
     public String nodeName; // this is nodeName which have these IP and port.
 
-    public String reverseName;
     public String remoteNodeName;
     public String cookie; // MD5
 
@@ -23,11 +22,10 @@
         this.port = port;
     }
 
-    public HostMessage(String name, int port, String connectionName, String reverseName) {
+    public HostMessage(String name, int port, String connectionName) {
         this.hostName = name;
         this.port = port;
         this.connectionName = connectionName;
-        this.reverseName = reverseName;
     }
 
     public boolean isAlive() {
@@ -36,7 +34,7 @@
 
     public String toString() {
         return "HostMessage : name = " + hostName + ", port = " + Integer.toString(port) + " connectionName = " +
-                connectionName + " absName = " + nodeName + "reverseName = " + reverseName + " remoteAbsName = " + remoteNodeName
+                connectionName + " absName = " + nodeName + " remoteAbsName = " + remoteNodeName
                 + " cokkie = " + cookie ;
     }
 }
--- a/src/main/java/christie/topology/manager/CreateTreeTopology.java	Sat Sep 15 11:27:36 2018 +0900
+++ b/src/main/java/christie/topology/manager/CreateTreeTopology.java	Sat Sep 15 17:41:14 2018 +0900
@@ -63,9 +63,8 @@
             // put parent information own
             String parentNodeName = parentManager.getMyParent();
             HostMessage parent = nameTable.get(parentNodeName);
-            int num = parentManager.getMyNumber();
 
-            HostMessage newParentHost = new HostMessage(parent.hostName, parent.port, "parent", "child" + num);
+            HostMessage newParentHost = new HostMessage(parent.hostName, parent.port, "parent");
             newParentHost.nodeName = parentNodeName;
             newParentHost.remoteNodeName = nodeName; // address
 
@@ -73,7 +72,7 @@
             cgm.setup(new RecordTopology());
 
             // put own information parent
-            HostMessage newChildHost = new HostMessage(newHost.hostName, newHost.port, "child" + num, "parent");
+            HostMessage newChildHost = new HostMessage(newHost.hostName, newHost.port, "child" + parentManager.getMyNumber());
             newChildHost.nodeName = nodeName;
             newChildHost.remoteNodeName = parentNodeName;
 
--- a/src/main/java/christie/topology/manager/FileParser.java	Sat Sep 15 11:27:36 2018 +0900
+++ b/src/main/java/christie/topology/manager/FileParser.java	Sat Sep 15 17:41:14 2018 +0900
@@ -46,7 +46,6 @@
                 }
 
                 ArrayList<Edge> edges = digraph.getEdges();
-                HashMap<String, NodeInfo> hash = new HashMap<>();
 
                 String connection;
                 String source;
--- a/src/main/java/christie/topology/manager/IncomingHosts.java	Sat Sep 15 11:27:36 2018 +0900
+++ b/src/main/java/christie/topology/manager/IncomingHosts.java	Sat Sep 15 17:41:14 2018 +0900
@@ -44,7 +44,7 @@
         LinkedList<NodeInfo> nodeInfoList = resultParse.get(nodeName);
         getDGM(nodeName).put("connectNodeNum", nodeInfoList.size());
         for (NodeInfo nodeInfo : nodeInfoList) {
-            HostMessage hostMessage = new HostMessage(newHost.hostName, newHost.port, nodeInfo.connectionName, "");
+            HostMessage hostMessage = new HostMessage(newHost.hostName, newHost.port, nodeInfo.connectionName);
             hostMessage.nodeName = nodeName;
             hostMessage.remoteNodeName = nodeInfo.targetNodeName;
 
--- a/src/main/java/christie/topology/manager/SearchHostName.java	Sat Sep 15 11:27:36 2018 +0900
+++ b/src/main/java/christie/topology/manager/SearchHostName.java	Sat Sep 15 17:41:14 2018 +0900
@@ -77,7 +77,7 @@
         for (LinkedList<HostMessage> list :topology.values()){
             System.out.print(list.get(0).remoteNodeName+" : ");
             for (HostMessage host : list){
-                System.out.print("[ "+host.nodeName+" "+host.hostName+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteNodeName+" ]");
+                System.out.print("[ "+host.nodeName+" "+host.hostName+" "+host.port+" "+host.connectionName+" "+host.remoteNodeName+" ]");
             }
             System.out.println();
         }