Mercurial > hg > Database > Christie
changeset 50:8dfd93810041
fix config and HostMessage
author | akahori |
---|---|
date | Thu, 23 Aug 2018 09:30:36 +0900 |
parents | fd944876257b |
children | 597315102875 |
files | src/main/java/christie/daemon/Config.java src/main/java/christie/topology/HostMessage.java src/main/java/christie/topology/manager/CheckComingHost.java src/main/java/christie/topology/manager/ConfigWaiter.java src/main/java/christie/topology/manager/IncomingHosts.java src/main/java/christie/topology/manager/SearchHostName.java src/main/java/christie/topology/manager/StartTopologyManager.java src/main/java/christie/topology/manager/TopologyManager.java |
diffstat | 8 files changed, 37 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/daemon/Config.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/daemon/Config.java Thu Aug 23 09:30:36 2018 +0900 @@ -4,7 +4,6 @@ public class Config { - public int localPort = 10000; public String logFile = null; public Level level = Level.FATAL; public String MCSTADDR = "224.0.0.1"; @@ -13,9 +12,7 @@ public Config(String[] args) { for (int i = 0; i< args.length; i++) { - if ("-p".equals(args[i])) { - localPort = Integer.parseInt(args[++i]); - } else if ("-log".equals(args[i])) { + if ("-log".equals(args[i])) { logFile = args[++i]; } else if ("-n".equals(args[i])) { nis = args[++i];
--- a/src/main/java/christie/topology/HostMessage.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/topology/HostMessage.java Thu Aug 23 09:30:36 2018 +0900 @@ -5,7 +5,7 @@ @Message public class HostMessage { - public String name; + public String hostName; public int port; public String connectionName; @@ -19,12 +19,12 @@ public HostMessage() { } public HostMessage(String name, int port) { - this.name = name; + this.hostName = name; this.port = port; } public HostMessage(String name, int port, String connectionName, String reverseName) { - this.name = name; + this.hostName = name; this.port = port; this.connectionName = connectionName; this.reverseName = reverseName; @@ -35,7 +35,7 @@ } public String toString() { - return "HostMessage : name = " + name + ", port = " + Integer.toString(port) + " connectionName = " + + return "HostMessage : name = " + hostName + ", port = " + Integer.toString(port) + " connectionName = " + connectionName + " absName = " + absName + "reverseName = " + reverseName + " remoteAbsName = " + remoteAbsName + " cokkie = " + cookie ; }
--- a/src/main/java/christie/topology/manager/CheckComingHost.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/topology/manager/CheckComingHost.java Thu Aug 23 09:30:36 2018 +0900 @@ -35,7 +35,6 @@ getLocalDGM().put("newHost", hostMessage); } } - cgm.setup(new CheckComingHost()); }
--- a/src/main/java/christie/topology/manager/ConfigWaiter.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/topology/manager/ConfigWaiter.java Thu Aug 23 09:30:36 2018 +0900 @@ -11,8 +11,8 @@ // Question: done 変数がわからない...何やっているんだろう. // public Receiver done = ids.create(CommandType.TAKE); - @Take - boolean done; + //@Take + //boolean done; @Take int nodeNum;
--- a/src/main/java/christie/topology/manager/IncomingHosts.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/topology/manager/IncomingHosts.java Thu Aug 23 09:30:36 2018 +0900 @@ -22,7 +22,8 @@ @Take // new coming host info HostMessage newHost; - @Take + //@Take + @Peek HashMap<String, String> absCookieTable; @Take @@ -42,19 +43,19 @@ String nodeName = nodeNames.poll(); // Manager connect to Node - cgm.createRemoteDGM(nodeName, newHost.name, newHost.port); + cgm.createRemoteDGM(nodeName, newHost.hostName, newHost.port); getDGM(nodeName).put( "host", nodeName); absCookieTable.put(MD5, nodeName); - getLocalDGM().put("absCookieTable", absCookieTable); + //getLocalDGM().put("absCookieTable", absCookieTable); getDGM(nodeName).put("cookie", MD5); log.info( "toplology manager connected from " + nodeName); LinkedList<NodeInfo> nodeInfoList = resultParse.get(nodeName); for (NodeInfo nodeInfo : nodeInfoList) { - HostMessage hostMessage = new HostMessage(newHost.name, newHost.port, + HostMessage hostMessage = new HostMessage(newHost.hostName, newHost.port, nodeInfo.connectionName, nodeInfo.reverseName); hostMessage.absName = nodeName; hostMessage.remoteAbsName = nodeInfo.sourceNodeName;
--- a/src/main/java/christie/topology/manager/SearchHostName.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/topology/manager/SearchHostName.java Thu Aug 23 09:30:36 2018 +0900 @@ -34,7 +34,7 @@ // Question: remove処理 どうしようか. いらない気もする. // DataSegment.remove(hostInfo.absName); - cgm.createRemoteDGM(reconnectHost.absName, reconnectHost.name, reconnectHost.port); + cgm.createRemoteDGM(reconnectHost.absName, reconnectHost.hostName, reconnectHost.port); getDGM(reconnectHost.absName).put("host", reconnectHost.absName); // put Host dataSegment on reconnect node @@ -62,8 +62,8 @@ // find and update old info if (!reconnectHost.absName.equals(host.absName)) continue; - if (!reconnectHost.name.equals(host.name) || reconnectHost.port != host.port){ - host.name = reconnectHost.name; + if (!reconnectHost.hostName.equals(host.hostName) || reconnectHost.port != host.port){ + host.hostName = reconnectHost.hostName; host.port = reconnectHost.port; getLocalDGM().put(host.remoteAbsName, host); @@ -77,7 +77,7 @@ for (LinkedList<HostMessage> list :topology.values()){ 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.print("[ "+host.absName+" "+host.hostName+" "+host.port+" "+host.connectionName+" "+host.reverseName+" "+host.remoteAbsName+" ]"); } System.out.println(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/topology/manager/StartTopologyManager.java Thu Aug 23 09:30:36 2018 +0900 @@ -0,0 +1,21 @@ +package christie.topology.manager; + +import christie.codegear.CodeGearManager; +import christie.codegear.StartCodeGear; + +public class StartTopologyManager extends StartCodeGear{ + TopologyManagerConfig conf; + + public StartTopologyManager(CodeGearManager cgm, TopologyManagerConfig conf){ + super(cgm); + this.conf = conf; + + } + + @Override + protected void run(CodeGearManager cgm) { + cgm.setup(new TopologyManager(this.conf)); + } + + +}
--- a/src/main/java/christie/topology/manager/TopologyManager.java Thu Aug 23 09:29:05 2018 +0900 +++ b/src/main/java/christie/topology/manager/TopologyManager.java Thu Aug 23 09:30:36 2018 +0900 @@ -35,7 +35,6 @@ // if (!conf.dynamic) は, conf.dynamic = trueの動作がわからないので, 省いた. - LinkedList<String> nodeNames = new LinkedList<>(); HashMap<String, LinkedList<NodeInfo>> topology = new HashMap<>(); int nodeNum = 0; @@ -112,8 +111,6 @@ cgm.setup(new IncomingHosts()); - - // Question: この処理何をやっているのかわからない. 一応, その下にそれっぽいコードを書いた. // ConfigWaiter cs3 = new ConfigWaiter(nodeNum); // cs3.done.setKey("local", "done"); @@ -123,8 +120,6 @@ - - getLocalDGM().put("topology", new HashMap<String, LinkedList<HostMessage>>()); getLocalDGM().put("createdList", new LinkedList<String>()); cgm.setup(new CreateHash());