annotate src/alice/topology/node/StartTopologyNode.java @ 46:1a498f436332

bug fix for time calculate
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Sat, 04 Feb 2012 16:03:05 +0900
parents ca079a730d0b
children 7982324d4329
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package alice.topology.node;
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import java.net.InetAddress;
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 import java.net.UnknownHostException;
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 import alice.codesegment.CodeSegment;
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 import alice.datasegment.DataSegment;
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 import alice.topology.HostMessage;
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 public class StartTopologyNode extends CodeSegment {
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
26
9c6b9e032338 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
12 private TopologyNodeConfig conf;
46
1a498f436332 bug fix for time calculate
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 34
diff changeset
13 private CodeSegment startCS;
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
46
1a498f436332 bug fix for time calculate
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 34
diff changeset
15 public StartTopologyNode(TopologyNodeConfig conf, CodeSegment startCS) {
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 this.conf = conf;
46
1a498f436332 bug fix for time calculate
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 34
diff changeset
17 this.startCS = startCS;
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 }
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 @Override
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 public void run() {
34
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
22 DataSegment.connect("manager", "", conf.managerHostName, conf.managerPort);
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
23 String localHostName = null;
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 try {
34
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
25 localHostName = InetAddress.getLocalHost().getHostName();
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 } catch (UnknownHostException e) {
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 e.printStackTrace();
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }
34
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
29 HostMessage host;
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
30 host = new HostMessage(localHostName, conf.localPort);
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
31 ods.put("manager", "host", host);
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
28
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
33 IncomingAbstractHostName cs1 = new IncomingAbstractHostName();
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
34 cs1.absName.setKey("local", "host");
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
35
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
36 IncomingReverseKey cs2 = new IncomingReverseKey();
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
37 cs2.reverseKey.setKey("local", "reverseKey");
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
38 cs2.reverseCount.setKey("local", "reverseCount");
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
39
34
ca079a730d0b added method to OutputDataSegment and Receiver, to convert type from Value to Class<?> without MessagePack
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
40 ods.put("local", "reverseCount", 0);
28
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
41
46
1a498f436332 bug fix for time calculate
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 34
diff changeset
42 ConfigurationFinish cs3 = new ConfigurationFinish(startCS);
28
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
43 cs3.reverseCount.setKey("local", "reverseCount");
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
44 cs3.configNodeNum.setKey("local", "configNodeNum");
25
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 }
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
50c75cb3de60 implements TopologyNode
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 }