Mercurial > hg > Database > Alice
changeset 414:b42eee3348b2 dispose
Merge with 74e13553e3e313669b293d3eecf00e65b7bd7dff
author | sugi |
---|---|
date | Mon, 07 Jul 2014 16:23:58 +0900 |
parents | b7a211b3f3e0 (current diff) 74e13553e3e3 (diff) |
children | 79a0c18dd2c3 |
files | |
diffstat | 2 files changed, 35 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/topology/manager/IncomingHosts.java Mon Jul 07 16:21:11 2014 +0900 +++ b/src/main/java/alice/topology/manager/IncomingHosts.java Mon Jul 07 16:23:58 2014 +0900 @@ -12,38 +12,40 @@ import alice.topology.HostMessage; public class IncomingHosts extends CodeSegment { - - HashMap<String, LinkedList<NodeInfo>> topology; - LinkedList<String> nodeNames; - Receiver host = ids.create(CommandType.TAKE); - - public IncomingHosts(HashMap<String, LinkedList<NodeInfo>> topology, LinkedList<String> nodeNames) { - this.topology = topology; - this.nodeNames = nodeNames; - } + + HashMap<String, LinkedList<NodeInfo>> topology; + LinkedList<String> nodeNames; + Receiver host = ids.create(CommandType.TAKE); + + public IncomingHosts(HashMap<String, LinkedList<NodeInfo>> topology, + LinkedList<String> nodeNames) { + this.topology = topology; + this.nodeNames = nodeNames; + this.host.setKey("local", "host"); + } - @Override - public void run() { - HostMessage host = this.host.asClass(HostMessage.class); - String nodeName = nodeNames.poll(); - // Manager connect to Node - DataSegment.connect(nodeName, "", host.name, host.port); - ods.put(nodeName, "host", nodeName); - LinkedList<NodeInfo> nodes = topology.get(nodeName); - for (NodeInfo nodeInfo : nodes) { - HostMessage newHost = new HostMessage(host.name, host.port, nodeInfo.connectionName, nodeInfo.reverseName); - ods.put("local", nodeInfo.sourceNodeName, newHost); - } - - if (nodeNames.isEmpty()) { - // configuration finish - for (String key : topology.keySet()) { - ods.put("local", key, ValueFactory.createNilValue()); - } - } else { - IncomingHosts cs = new IncomingHosts(topology, nodeNames); - cs.host.setKey("local", "host"); - } - } + @Override + public void run() { + HostMessage host = this.host.asClass(HostMessage.class); + String nodeName = nodeNames.poll(); + // Manager connect to Node + DataSegment.connect(nodeName, "", host.name, host.port); + ods.put(nodeName, "host", nodeName); + LinkedList<NodeInfo> nodes = topology.get(nodeName); + for (NodeInfo nodeInfo : nodes) { + HostMessage newHost = new HostMessage(host.name, host.port, + nodeInfo.connectionName, nodeInfo.reverseName); + ods.put("local", nodeInfo.sourceNodeName, newHost); + } + + if (nodeNames.isEmpty()) { + // configuration finish + for (String key : topology.keySet()) { + ods.put("local", key, ValueFactory.createNilValue()); + } + } else { + new IncomingHosts(topology, nodeNames); + } + } }
--- a/src/main/java/alice/topology/manager/StartTopologyManager.java Mon Jul 07 16:21:11 2014 +0900 +++ b/src/main/java/alice/topology/manager/StartTopologyManager.java Mon Jul 07 16:23:58 2014 +0900 @@ -76,8 +76,7 @@ e.printStackTrace(); } - IncomingHosts cs1 = new IncomingHosts(topology, nodeNames); - cs1.host.setKey("local", "host"); + new IncomingHosts(topology, nodeNames); ConfigWaiter cs3 = new ConfigWaiter(nodeNum); cs3.done.setKey("local", "done");