Mercurial > hg > Database > Alice
view src/main/java/alice/topology/node/StartTopologyNode.java @ 587:4d38c71938f5 dispose
change ConfigrationFinish
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jan 2016 20:31:06 +0900 |
parents | ba4ec1a593f9 |
children | dd9bd18fd878 |
line wrap: on
line source
package alice.topology.node; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.LinkedList; import alice.codesegment.CodeSegment; import alice.datasegment.DataSegment; import alice.topology.HostMessage; public class StartTopologyNode extends CodeSegment { private LinkedList<TopologyNodeConfig> configs; private TopologyNodeConfig conf; private CodeSegment startCS; private int topMNumber; public StartTopologyNode(LinkedList<TopologyNodeConfig> configs, CodeSegment startCS, int topMNum) { this.configs = configs; this.conf = configs.get(topMNum - 1); this.startCS = startCS; this.topMNumber = topMNum; } @Override public void run() { DataSegment.connect("manager"+ topMNumber, "manager" + topMNumber, conf.getManagerHostName(), conf.getManagerPort()); String localHostName = null; try { localHostName = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } new SaveCookie(topMNumber); HostMessage host = new HostMessage(localHostName, conf.localPort, topMNumber); host.cookie = conf.cookie; ods.put("manager" + topMNumber, "host", host); ods.put("_CLIST", new ArrayList<String>()); IncomingAbstractHostName cs = new IncomingAbstractHostName(topMNumber); cs.absName.setKey("local", "host"+topMNumber); IncomingReverseKey cs2 = new IncomingReverseKey(); cs2.reverseKey.setKey("local", "reverseKey"); cs2.reverseCount.setKey("local", "reverseCount"); ods.put("local", "reverseCount", 0); if (topMNumber == 1){ ConfigurationFinish cs3 = new ConfigurationFinish(startCS, topMNumber); cs3.reverseCount.setKey("local", "reverseCount"); cs3.configNodeNum.setKey("local", "configNodeNum"); } else { new StartTopologyNode(configs, startCS, topMNumber - 1).execute(); } } }