Mercurial > hg > Members > tatsuki > Alice
comparison src/alice/topology/manager/StartTopologyManager.java @ 35:ac3b48c5f4da
share width each other with tree
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Jan 2012 04:00:12 +0900 |
parents | b5a21baf0b07 |
children | 92aeb6e34683 |
comparison
equal
deleted
inserted
replaced
34:ca079a730d0b | 35:ac3b48c5f4da |
---|---|
28 | 28 |
29 @Override | 29 @Override |
30 public void run() { | 30 public void run() { |
31 LinkedList<String> nodeNames = new LinkedList<String>(); | 31 LinkedList<String> nodeNames = new LinkedList<String>(); |
32 HashMap<String, LinkedList<NodeInfo>> topology = new HashMap<String, LinkedList<NodeInfo>>(); | 32 HashMap<String, LinkedList<NodeInfo>> topology = new HashMap<String, LinkedList<NodeInfo>>(); |
33 int nodeNum = 0; | |
33 try { | 34 try { |
34 FileReader reader = new FileReader(new File(conf.confFilePath)); | 35 FileReader reader = new FileReader(new File(conf.confFilePath)); |
35 Parser parser = new Parser(); | 36 Parser parser = new Parser(); |
36 parser.parse(reader); | 37 parser.parse(reader); |
37 ArrayList<Graph> graphs = parser.getGraphs(); | 38 ArrayList<Graph> graphs = parser.getGraphs(); |
38 for (Graph graph : graphs) { | 39 for (Graph graph : graphs) { |
39 ArrayList<Node> nodes = graph.getNodes(false); | 40 ArrayList<Node> nodes = graph.getNodes(false); |
41 nodeNum = nodes.size(); | |
40 for (Node node : nodes) { | 42 for (Node node : nodes) { |
41 String nodeName = node.getId().getId(); | 43 String nodeName = node.getId().getId(); |
42 nodeNames.add(nodeName); | 44 nodeNames.add(nodeName); |
43 topology.put(nodeName, new LinkedList<NodeInfo>()); | 45 topology.put(nodeName, new LinkedList<NodeInfo>()); |
44 } | 46 } |
59 String target = edge.getTarget().getNode().getId().getId(); | 61 String target = edge.getTarget().getNode().getId().getId(); |
60 NodeInfo nodeInfo = hash.get(target + source); | 62 NodeInfo nodeInfo = hash.get(target + source); |
61 if (nodeInfo != null) { | 63 if (nodeInfo != null) { |
62 nodeInfo.reverseName = connection; | 64 nodeInfo.reverseName = connection; |
63 } | 65 } |
64 | |
65 } | 66 } |
66 } | 67 } |
67 | 68 |
68 } catch (FileNotFoundException e) { | 69 } catch (FileNotFoundException e) { |
69 logger.error("File not found: " + conf.confFilePath); | 70 logger.error("File not found: " + conf.confFilePath); |
76 IncomingHosts cs1 = new IncomingHosts(topology, nodeNames); | 77 IncomingHosts cs1 = new IncomingHosts(topology, nodeNames); |
77 cs1.host.setKey("local", "host"); | 78 cs1.host.setKey("local", "host"); |
78 | 79 |
79 TopologyFinish cs2 = new TopologyFinish(); | 80 TopologyFinish cs2 = new TopologyFinish(); |
80 cs2.finish.setKey("local", "finish"); | 81 cs2.finish.setKey("local", "finish"); |
82 | |
83 ConfigWaiter cs3 = new ConfigWaiter(nodeNum); | |
84 cs3.done.setKey("local", "done"); | |
81 } | 85 } |
82 | 86 |
83 } | 87 } |