Mercurial > hg > Database > Alice
view src/main/java/alice/topology/manager/IncomingHosts.java @ 466:268b1280dc18 dispose
remove debug message
author | sugi |
---|---|
date | Sat, 15 Nov 2014 04:48:35 +0900 |
parents | c973f7ee7c91 |
children | 0832af83583f 767d93626b88 1a860019b2fe ffa43f252492 ffaacab84d1a |
line wrap: on
line source
package alice.topology.manager; import java.util.HashMap; import java.util.LinkedList; import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; import alice.datasegment.Receiver; import alice.topology.HostMessage; public class IncomingHosts extends CodeSegment { private Receiver topology = ids.create(CommandType.TAKE); // Topology from parse file private Receiver nodeNames = ids.create(CommandType.TAKE); // nodeName list private Receiver host = ids.create(CommandType.TAKE); // new coming host info private Receiver absCookieTable = ids.create(CommandType.TAKE); // cookie, AbsName HashMap private Receiver cookie = ids.create(CommandType.TAKE); // MD5 public IncomingHosts() { this.topology.setKey("resultParse"); this.nodeNames.setKey("nodeNames"); this.host.setKey("newHost"); this.absCookieTable.setKey("absCookieTable"); this.cookie.setKey("MD5"); } @Override public void run() { HostMessage host = this.host.asClass(HostMessage.class); @SuppressWarnings("unchecked") HashMap<String, String> absCookieTable = this.absCookieTable.asClass(HashMap.class); @SuppressWarnings("unchecked") HashMap<String, LinkedList<NodeInfo>> topology = this.topology.asClass(HashMap.class); @SuppressWarnings("unchecked") LinkedList<String> nodeNames = this.nodeNames.asClass(LinkedList.class); // not have or match cookie String nodeName = nodeNames.poll(); // Manager connect to Node DataSegment.connect(nodeName, "", host.name, host.port); ods.put(nodeName, "host", nodeName); String cookie = this.cookie.asString(); absCookieTable.put(cookie, nodeName); ods.put(this.absCookieTable.key, absCookieTable); ods.put(nodeName, "cookie", cookie); LinkedList<NodeInfo> nodes = topology.get(nodeName); for (NodeInfo nodeInfo : nodes) { HostMessage newHost = new HostMessage(host.name, host.port, nodeInfo.connectionName, nodeInfo.reverseName); newHost.absName = nodeName; newHost.remoteAbsName = nodeInfo.sourceNodeName; ods.put("nodeInfo", newHost); ods.put(nodeInfo.sourceNodeName, newHost); new RecodeTopology(); } if (nodeNames.isEmpty()) { // configuration finish for (String key : topology.keySet()) { ods.put("local", key, ValueFactory.createNilValue()); } } ods.put(this.nodeNames.key, nodeNames); ods.put(this.topology.key, topology); new IncomingHosts(); } }